Java API for JSON
JSON's primary advantage over other data interchange formats such as XML is that
JSON is both easy for humans to read and easy for computers to generate and parse.
It is commonly used in many modern web applications.
Java EE 7 introduces the Java API for JSON Processing ( JSON-P ), which is a
standard Java EE API to parse and generate JSON data.
JSON-P provides two ways to both parse and generate JSON data: the object model
API and the streaming API.
In this chapter, we will cover the following topics:
• The JSON-P object model API:
° Generating JSON data with the JSON-P object model API
° Parsing JSON data with the JSON-P object model API
• The JSON-P streaming API:
° Generating JSON data with the JSON-P streaming API
° Parsing JSON data with the JSON-P streaming API
The JSON-P object model API
The JSON-P model API allows us to generate an in-memory tree structured
representation of a JSON object. The JSON-P API uses the builder pattern, which
allows us as application developers to easily create a JSON representation of a