| Did you know ... | Search Documentation: |
| Pack logtalk -- logtalk-3.101.0/docs/apis/_sources/json_protocol_0.rst.txt |
.. index:: single: json_protocol .. _json_protocol/0:
.. rst-class:: right
protocol
json_protocolJSON parser and generator protocol.
| Availability:
| logtalk_load(json(loader))
| Author: Paulo Moura and Jacinto Dávila | Version: 1:0:0 | Date: 2026-07-05
| Compilation flags:
| static
| Dependencies: | (none)
| Remarks: | (none)
| Inherited public predicates: | (none)
.. contents:: :local: :backlinks: top
.. index:: parse/2 .. _json_protocol/0::parse/2:
parse/2 ^^^^^^^^^^^
Parses the JSON contents read from the given source (codes(List), stream(Stream), line(Stream), file(Path), chars(List), or atom(Atom)) into a term.
| Compilation flags:
| static
| Template:
| parse(Source,Term)
| Mode and number of proofs:
| parse(++compound,--term) - one_or_error
| Exceptions:
| Source is a variable:
| instantiation_error
| Source is neither a variable nor a valid JSON source term:
| domain_error(json_source,Source)
| Source is a valid JSON source term but does not contain parsable JSON:
| domain_error(json,Source)
.. index:: generate/2 .. _json_protocol/0::generate/2:
generate/2 ^^^^^^^^^^^^^^
Generates the content using the representation specified in the first argument (codes(List), stream(Stream), file(Path), chars(List), or atom(Atom)) for the term in the second argument. Fails if this term cannot be processed.
| Compilation flags:
| static
| Template:
| generate(Sink,Term)
| Mode and number of proofs:
| generate(+compound,++term) - one_or_error
| Exceptions:
| Sink is a variable:
| instantiation_error
| Sink is neither a variable nor a valid JSON sink term:
| domain_error(json_sink,Sink)
| A JSON version of Term cannot be generated by the implementation:
| domain_error(json_term,Term)
(none)
(none)
(none)