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]
}
|}.