- Object model ( JsonReader/JsonWritter)
- Streaming (JsonParser/ JsonGenerator)
In the previous post we reviewed the use of JSON processing using object model : create objects with JsonBuilder, and I/O actions with JsonReader and JsonWritter.
Today, we will take a look to the other alternative of processing JSON with JsonParse and JsonGenerator.
Remember that working with Json processing requires to import the package javax.json.* (Available if we are working with Java7 enterprise edition).
Write with JsonGenerator
The output will be:
{"type":"cheeseburguer","drink":"coke","sides":["chips","salad"]}
Read with JsonParse
The output will be:
type
cheeseburguer
drink
coke
sides
chips
salad
No comments:
Post a Comment