On Tue, Oct 30, 2012 at 1:28 PM, Carlos Elói Barros <ce(a)declarativa.com> wrote:
Hi there,
It is possible to get some examples using json_to_string and string_to_json.
I trying to execute both and i get some errors. I am not an expert in Ciao Prolog or in Prolog, sorry.
Dear Carlos,
here are some example queries from a toplevel:
?- use_module(library(pillow(json))).
yes ?- string_to_json("{ "a":3, "b":true, "c":[1,2,3] }", X).
X = json([a=3,b=true,c=[1,2,3]]) ?
yes ?- json_to_string(json([a=3,b=true,c=[1,2,3]]), S).
S = "{""a"":3,""b"":true,""c"":123}" ?
yes ?-
Please, tell me if you have any problem running them. The library is in a very preliminary stage, but it should be usable. I will include some more examples in the library documentation as soon as possible (of course, any suggestion or contribution is welcome).
Cheers,