Join Alex Theedom for an in-depth discussion in this video Write JSON data, part of JSON Processing with Java EE.
- [Instructor] Okay, so we're going to generate…a string of JSON data, just as we did with the object model.…And by using the same JSON data.…If you want to follow along with this example,…open up the streaming example three class file…from the exercise folder.…As before, we're going to use a string writer.…This makes it easy to test, but you can use any…writer or output stream instance,…depending on the requirements.…Now, because there is a lot of JSON data to write,…I'm going to copy and paste a code from a file…in the exercise files associated with this lesson.…
I'm going to copy the entire write JSON stream…to string method.…So firstly, we start the construction of the JSON object…by calling the write start object on the generator instance.…Then, we call the write method for as many times…as there are elements in the object.…If an element is an array, we call the…write start array method.…And we continue calling write for each element…in the array until the end.…When we called write end, in order to signal…
Author
Released
6/5/2017In this course, discover how to use the Java Enterprise Edition (EE) JSON-Processing API. With its two programming models, JSON-Processing is one of the simplest ways to generate, query, and parse JSON data, and you'll find that implementing it in your projects is quick and easy. Join Alex Theedom as he covers an array of topics, including how to use both the object model and the streaming model, how to traverse a JSON structure, and how to parse JSON data using the extensive builder APIs. When you wrap up this course, you'll be ready to develop with this essential and powerful API.
- Working with JSON and Java
- JSON-Processing API features
- The Java EE JSON object model
- Creating a model from a JSON string
- Building a JSON model
- Traversing the JSON model
- Outputting the JSON model to a data stream
- Parsing and writing JSON data
Skill Level Intermediate
Duration
Views
Related Courses
-
Java EE: Web Services
with Patrick Royal2h 25m Intermediate -
Java EE: Servlets and JavaServer Faces
with Patrick Royal2h 11m Intermediate -
Java Platforms Compared: SE vs EE vs ME
with Peggy Fisher25m 38s Intermediate -
WebSocket Programming with Java EE
with Alex Theedom1h 29m Intermediate
-
Introduction
-
Welcome47s
-
What you should know1m 31s
-
Challenges39s
-
-
1. JSON and Java
-
Work with JSON and Java3m 57s
-
-
2. JSON-Processing API Features
-
JSON-P API introduction2m 18s
-
Headline features of JSON-P2m 41s
-
-
3. The Java EE JSON Object Model
-
JSON builder API1m 24s
-
Build a JSON model8m 30s
-
How to traverse the model1m 36s
-
Traverse the JSON model6m 19s
-
Solution: JSON array object1m 11s
-
4. The Java EE JSON Streaming Model
-
Parse JSON data6m 47s
-
Write JSON data2m 3s
-
Conclusion
-
Next steps1m 19s
-
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.
CancelTake notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.
Share this video
Embed this video
Video: Write JSON data