Skip to content

Commit

Permalink
Make the example a bit more understandable
Browse files Browse the repository at this point in the history
Quoted string literals are a bit obscure, I'd prefer to not use them but
I don't want to escape " everywhere, turning it into a mess of \".
  • Loading branch information
Leonidas-from-XIV committed Jul 21, 2020
1 parent 5d189f7 commit ec0fcbc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,17 @@ Currently at https://ocaml-community.github.io/yojson/
Examples
--------

A simple example on how to parse JSON that is in a string.
A simple example on how to parse JSON from a string literal.

```ocaml
let to_parse = {|
let json_string = {|
{"number" : 42,
"string" : "yes",
"list": ["for", "sure", 42]}|}
(* val json_string : string *)
let json = Yojson.Safe.from_string to_parse
let json = Yojson.Safe.from_string json_string
(* val json : Yojson.Safe.t *)
Format.printf "Parsed to %a" Yojson.Safe.pp json
```
Expand Down

0 comments on commit ec0fcbc

Please sign in to comment.