/usr/lib/swipl/library/ext/json/json.pl
All Application Manual Name SummaryHelp

  • ext
    • json
      • json.pl -- 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
      • json_grammar.pl -- JavaScript grammar
      • json_convert.pl
      • json_rpc_client.pl -- JSON RPC client
      • json_rpc_server.pl
      • json_schema.pl -- JSON Schema reader and validator
 json(+Content, +Vars, +VarDict, -JSON) is det
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]
      }
  |}.