term_to_json.pl
- term_to_json(+Term, +Bindings, -JsonTerm) is det
- term_to_json(+Term, -JsonTerm) is det
- Convert any general Prolog term into a JSON term. Prolog lists
are treated in a special way. Also, JSON terms are not
converted. Mapping:
- Variable:
{"type":"var", "name":<string>}
- Atom:
{"type":"atom", "value":<string>}
- Integer:
{"type":"integer", "value":<integer>}
- Float:
{"type":"float", "value":<float>}
- List: JSON array
- Dict: a JSON object. Values are processed recursively. (the tag is ignored)
json([Key=Value, ...])
: a JSON object Values are processed recursively.- compound:
{"type":"compound", "functor":<string>, "args":<array>}
- Variable:
- term_to_json(+Term, +Bindings, -JsonTerm) is det
- term_to_json(+Term, -JsonTerm) is det
- Convert any general Prolog term into a JSON term. Prolog lists
are treated in a special way. Also, JSON terms are not
converted. Mapping:
- Variable:
{"type":"var", "name":<string>}
- Atom:
{"type":"atom", "value":<string>}
- Integer:
{"type":"integer", "value":<integer>}
- Float:
{"type":"float", "value":<float>}
- List: JSON array
- Dict: a JSON object. Values are processed recursively. (the tag is ignored)
json([Key=Value, ...])
: a JSON object Values are processed recursively.- compound:
{"type":"compound", "functor":<string>, "args":<array>}
- Variable: