User Guide
Trial.protocol can process JSON incrementally or via serialization. Incremental processing handles JSON one token at the time, whereas serialization processes the entire JSON buffer in a single operation. A token is a single element in the JSON grammar, such as a number, a string, the beginning or the end of an array.
Incremental processing has a lower-level interface than serialization or document processing, but even though incremental processing is more laborious to use, it covers more use cases and can be used more efficiently. Some examples of these use cases are:
-
The input and output serialization archives are build on top of incremental parser and generators.
-
Certain operations on JSON buffers does not require that individual JSON elements, such as JSON escaped strings, are converted into in-memory data structures. For instance, searching for data in a JSON file, or pretty-printing the content of a JSON file.
-
We can build other parser types from an incremental parser, such as the push parser in the tutorials.