Convert dictionary to json dictionary?

' by default is an atom not a string, :slightly_smiling_face:

e.g.

?- atom('p→q').
true.

?- string('p→q').
false.

Strings are created with " by default.

e.g.

?- atom("p→q").
false.

?- string("p→q").
true.

Some of these defaults can be changed with Prolog flags but you did not note the use of such so in reading your question I would take that you are using the defaults.


EDIT

In the title you note json dictionary, which may lead one to think there is a SWI-Prolog dictionary just for json. AFAIK there is none. JSON can be converted to/from an SWI-Prolog dictionary most of the time and with caveats. See: Json_dict/2 - Helpful for learning how to use JSON with SWI-Prolog dict

Also of value: Sites for testing JSON

1 Like