From the course: JSON Processing with Java EE

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Introduction to the streaming model

Introduction to the streaming model

From the course: JSON Processing with Java EE

Start my 1-month free trial

Introduction to the streaming model

- [Instructor] The streaming model reads JSON data one element at a time and fires an event each time it reaches one of the following elements: The start and end of an object, the start and end of an array, a key name, and any string, number, Boolean, and NULL value. The parser stops at each event. It can then either process the element or discard it. It moves on to the next event until all elements in the JSON data stream have been parsed. This is very efficient low-level API designed for passing large quantities of JSON data. API consists of two principal interfaces, JsonParser and JsonGenerator. Both interfaces are located in the Javax.json.stream package. The JsonParser interface provides read-only access to the JSON data as it parses it. It traverses in the forward direction only. The next element in the JSON document is pulled by calling the next method in the parser interface. This continues until the data is exhausted. The JsonGenerator interface provides a collection of…

Contents