This gives a developer more procedural control over the JSON processing. The streaming API provides an event-based parser and allows an application developer to ask for the next event rather than handling the event in a callback. It hands over parsing and generation control to the programmer. The streaming API provides a way to parse and generate JSON in a streaming fashion.
However, it is often not as efficient as the streaming model and requires more memory. This programming model is the most flexible and enables processing that requires random access to the complete contents of the tree. The tree can then be navigated and queried.
The object model API creates a random-access, tree-like structure that represents the JSON data in memory. The Java API for JSON Processing ( JSR 353) provides portable APIs to parse, generate, transform, and query JSON using object model and streaming APIs. All popular websites offer JSON as the data exchange format with their RESTful web services. JSON is often used in Ajax applications, configurations, databases, and RESTful web services. Example of JSON representation of an object