protocol

# `json_protocol`

JSON parser and generator protocol.

Author: Paulo Moura and Jacinto Dávila
Version: 0:10:0
Date: 2021-03-22
Compilation flags:
`static`
Dependencies:
(none)
Remarks:
(none)
Inherited public predicates:
(none)

- Public predicates

  - `parse/2`

  - `generate/2`

- Protected predicates

- Private predicates

- Operators

## Public predicates

### `parse/2`

Parses the JSON contents read from the given source (`codes(List)`, `stream(Stream)`, `file(Path)`, `chars(List)`, or `atom(Atom)`) into a term. Fails if the JSON contents cannot be parsed.

Compilation flags:
`static`
Template:
`parse(Source,Term)`
Mode and number of proofs:
`parse(++compound,--term)` - `one_or_error`

### `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`

## Protected predicates

(none)

## Private predicates

(none)

## Operators

(none)