Nested Prolog term to JSON object conversion
Wouter Beek <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <CAE1un7P7mrK05+LTmc4GVEA3HvW7KNf4wSBX1AofF6xmwCkLcQ@mail.gmail.com> |
Hi all, Has somebody been able to convert nested Prolog terms into JSON objects using json_object/1 declarations? ~~~ :- module(test, [test/0]). :- use_module(library(http/json_convert)). :- json_object circle(coord:atom) + [type=circle]. :- json_object coord(x:float, y:float) + [type=coord]. test:- prolog_to_json(circle(coord(3.4,4.3)), JSON_Object), format(user_output, '~w', JSON_Object). ~~~ At some points in the trace, the contents of coord/1 are assumed to be atomic :-( --- Cheers!, Wouter. E-mail: [email protected] WWW: www.wouterbeek.com Tel.: 0647674624 -------------- next part -------------- HTML attachment scrubbed and removed