7.1 /tmp/src/swipl-8.1.1/packages/http/json.pl: Reading and writing JSON serialization
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
    • Packages
      • SWI-Prolog HTTP support
        • Supporting JSON
          • /tmp/src/swipl-8.1.1/packages/http/json.pl: Reading and writing JSON serialization
            • atom_json_term/3
            • json_read/2
            • json_read/3
            • json_write/2
            • json_write/3
            • is_json_term/1
            • is_json_term/2
            • json_read_dict/2
            • json_read_dict/3
            • json_write_dict/2
            • json_write_dict/3
            • atom_json_dict/3
            • json_read/2
            • json_read/3
            • json_write/2
            • json_write/3
            • is_json_term/1
            • is_json_term/2
            • json_read_dict/2
            • json_read_dict/3
            • json_write_dict/2
            • json_write_dict/3
Availability::- use_module(library(http/json)).
Source[det]json_read_dict(+Stream, -Dict)
[det]json_read_dict(+Stream, -Dict, +Options)
Read a JSON object, returning objects as a dicts. The representation depends on the options, where the default is:

  • String values are mapped to Prolog strings
  • JSON true, false and null are represented using these Prolog atoms.
  • JSON objects are mapped to dicts.
  • Optionally, a type field in an object assigns a tag for the dict.

The predicate json_read_dict/3 processes the same options as json_read/3, but with different defaults. In addition, it processes the tag option. See json_read/3 for details about the shared options.

tag(+Name)
When converting to/from a dict, map the indicated JSON attribute to the dict tag. No mapping is performed if Name is the empty atom ('', default). See json_read_dict/2 and json_write_dict/2.
default_tag(+Tag)
Provide the default tag if the above tag option does not apply.
null(+NullTerm)
Default the atom null.
true(+TrueTerm)
Default the atom true.
false(+FalseTerm)
Default the atom false
value_string_as(+Type)
Prolog type used for strings used as value. Default is string. The alternative is atom, producing a packed string object.
Availability::- use_module(library(http/json)).
Source[det]json_read_dict(+Stream, -Dict)
[det]json_read_dict(+Stream, -Dict, +Options)
Read a JSON object, returning objects as a dicts. The representation depends on the options, where the default is:

  • String values are mapped to Prolog strings
  • JSON true, false and null are represented using these Prolog atoms.
  • JSON objects are mapped to dicts.
  • Optionally, a type field in an object assigns a tag for the dict.

The predicate json_read_dict/3 processes the same options as json_read/3, but with different defaults. In addition, it processes the tag option. See json_read/3 for details about the shared options.

tag(+Name)
When converting to/from a dict, map the indicated JSON attribute to the dict tag. No mapping is performed if Name is the empty atom ('', default). See json_read_dict/2 and json_write_dict/2.
default_tag(+Tag)
Provide the default tag if the above tag option does not apply.
null(+NullTerm)
Default the atom null.
true(+TrueTerm)
Default the atom true.
false(+FalseTerm)
Default the atom false
value_string_as(+Type)
Prolog type used for strings used as value. Default is string. The alternative is atom, producing a packed string object.