• Places
    • Home
    • Graphs
    • Prefixes
  • Admin
    • Users
    • Settings
    • Plugins
    • Statistics
  • CPACK
    • Home
    • List packs
    • Submit pack
  • Repository
    • Load local file
    • Load from HTTP
    • Load from library
    • Remove triples
    • Clear repository
  • Query
    • YASGUI SPARQL Editor
    • Simple Form
    • SWISH Prolog shell
  • Help
    • Documentation
    • Tutorial
    • Roadmap
    • HTTP Services
  • Login

1.1 library(json): Reading and writing JSON serialization
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
    • Packages
      • SWI-Prolog JSON library
        • Supporting JSON
          • library(json): Reading and writing JSON serialization
            • atom_json_term/3
            • json_read/2
            • json_read/3
            • json_write/2
            • json_write/3
            • json_write_hook/4
            • json_dict_pairs/2
            • 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/4
Availability::- use_module(library(json)).(can be autoloaded)
Source[det]json(+Content, +Vars, +VarDict, -JSON)
The predicate json/4 implements JSON quasi quotations. These quotations produce a JSON dict that is suitable for json_write_dict/2. The quasi quoter only accepts valid, but possibly partial JSON documents. The quoter replaces content whose value is a Prolog variable that appears in the argument list of the json indicator. Notably, you can't use a Prolog variable in place of an object key. Here is an example.
  {|json(Name)||
      { "name": Name,
        "created": {
          "day":null,
          "month":"December",
          "year":2007
        },
        "confirmed":true,
        "members":[1,2,3]
      }
  |}.

ClioPatria (version V3.1.1-59-g7b9a7a3)