Java Reference
In-Depth Information
information += parser.getString()+", ";
information += " TRUE, ";
event =;
return information;
The streaming API consists of five interfaces, one enum class, and two exceptions.
All of them are contained in the package. Among these in-
terfaces, we have the JsonParser interface, which contains methods for step-by-
step read-only access to JSON data, and the JsonGenerator interface, which
provides methods to generate (write out) JSON step-by-step. Instances of these in-
terfaces can be created respectively with JsonParserFactory and JsonGener-
atorFactory factories. All events triggered by the streaming API are contained in
the JsonParser.Event enum class.
It's recommended to use the streaming API to parse large JSON files because, un-
like the object model API, it does not require loading the whole file before process-
ing. This ensures good memory management.
The object model API
The object model API is for JSON as DOM API is for XML. This means that it repres-
ents a JSON document as a tree structure in memory before giving the possibility to
navigate in or query the document. This API provides the most flexible way to parse
a JSON document by giving a random access to any data it contains. But in return,
it requires more memory. That is why it is not suitable for large documents.
The object model API consists of thirteen interfaces, one class, one enum class
and one exception. All of them are packages in javax.json . Among interfaces,
we have: JsonArrayBuilder and JsonObjectBuilder to build JSON arrays
Search WWH ::

Custom Search