Java Reference
In-Depth Information
and JSON objects respectively from scratch; JsonArray to access the ordered val-
ues of a JSON array as a list and JsonObject to access the values of a JSON
object as a Map and JsonBuilderFactory to create JsonObjectBuilder or
JsonArrayBuilder instances; JsonReader to read JSON from an input source
and JsonReaderFactory to create JsonReader instances; JsonWriter to write
JSON to an output source, and JsonWriterFactory to create JsonWriter in-
stances. The following code demonstrates how to create an object model from
scratch and access data within it.
The following code is an example of JSON processing using the object model API:
JsonObject objModel = Json.createObjectBuilder()
.add("id", "854963")
.add("name", "Louis Poyer")
.add("weight", 78.6)
.add("address","Rue 632"))
JsonObject student =
String name = student.getString("name");
JsonArray contact =
String address =
String phone =
Search WWH ::

Custom Search