Skip to content

Commit

Permalink
Added examples to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ayys committed Nov 19, 2020
1 parent a318116 commit 11d069e
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ GSON is an easy-to-use JSON library for
[Guile](https://www.gnu.org/software/guile/ "GNU/Guile Homepage").

## Getting Started

Let's get started with a very simple example. This example does not
perform exception handling.
```scheme
(use-modules (gson)
(ice-9 format))
;;; Import gson
(use-modules (gson))
;;; Define variable code which stores a JSON string
(define code
"
{
Expand All @@ -23,10 +27,22 @@ GSON is an easy-to-use JSON library for
]
}")
;;; Print the scheme representation of above JSON
(display(json-string->scm code))
(newline)
```

#### Output

```
((name . John Doe)
(age . 43)
(address
(street . 10 Downing Street)
(city . London))
(phones . #(+44 1234567 +44 2345678)))
```

## Installation

before installing, make sure you have Guile and make installed.
Expand All @@ -39,3 +55,12 @@ Once you've installed make, run the following command to install gson.
```bash
sudo make install
```

## Documentation
GSON module exports size functions in total. The definition and usage
examples of each of the functions is given below.

```scheme
procedure json-string->scm (string #:key number-hook nil-hook
list-hook object-hook string-hook boolean-hook)
```

0 comments on commit 11d069e

Please sign in to comment.