let json =
let s = `String "s" in
[%yojson {a = [%y s]; b = 2}]
to be rewritten as:
let json =
let s = `String "s" in
`Assoc [("a", s); ("b", `Int 2)]
Antiquotations for patterns
We want this:
match json with
| [%yojson? [%y? `String s]] -> s
| [%yojson? {a = [%y? a]; b = [%y? `Int b]}] ->
Printf.sprintf "%s and %d" (Yojson.Safe.to_string a) b
to be rewritten as:
match json with
| `String s -> s
| `Assoc [("a", a); ("b", `Int b)] ->
Printf.sprintf "%s and %d" (Yojson.Safe.to_string a) b
Internals
Ppx_yojson_lib
(#5)Ppx_yojson_lib
tests (#5)Features
Antiquotations for expressions
We want this:
to be rewritten as:
Antiquotations for patterns
We want this:
to be rewritten as: