This module defines a term representation for JSON (JavaScript Object Notation), as well as encoders and decoders.
Usage:
A JSON object.
json(json(Attrs)) :- json_attrs(Attrs).
Usage:
Attributes (pairs of key/value) of a JSON object.
json_attrs([]). json_attrs([X|Xs]) :- json_attr(X), json_attrs(Xs).
json_attr(Id=Val) :- atm(Id), json_val(Val).
json_val(string(X)) :- string(X). json_val(X) :- number(X). json_val(X) :- json(X). json_val(X) :- json_list(X). json_val(true). json_val(false). json_val(null).
Usage:
A list of JSON elements
Usage:json_to_string(Term,String)
Encode a JSON value Term as a character list.
Usage:string_to_json(String,Term)
Decode a character list as a JSON value Term.