Java Reference
In-Depth Information
XML data presentation
JSON data presentation
Java API for JSON processing
The Java API for JSON processing defines an API to process ( parse , generate ,
transform , and query ) JSON documents by using either the streaming API or the
object model API.
The streaming API
The streaming API is for JSON as StAX API is for XML. In other words, the stream-
ing API is an event-based JSON parsing. It parses a JSON file sequentially and fires
an event whenever a it encounters a new tag in the stream (new value String, new
start of objet, end of objet, new start of an array …). The example that follows shows
us how to get contact information within the JSON data presented on the previous
Example of JSON processing using the streaming API:
public String getStudentContact(String
jsonData) {
JsonParser parser = Json.createParser(new
Search WWH ::

Custom Search