From the course: Java EE 8 Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Object model writer

Object model writer - Java EE Tutorial

From the course: Java EE 8 Essential Training

Start my 1-month free trial

Object model writer

- [Narrator] In this lesson, we're going to build and configure a JSON Writer, and then use that JSON Writer to write JSON to an output source. So, to get started we're going to work within our order resource, once again. And this time, we're going to start out by building a Map. This map is going to contain configuration properties for our JSON Writer. It has two generic arguments. The first is a String, which will be the key for the Map; and, the second is a Boolean, which is the value for the Map. I'm going to name this Map configMap, and then I'm going to instantiate it as a new HashMap. Within the configMap, we're going to go ahead and add a property, using the PUT method, and that property is going to be found on our JSON Generator Object, and it's the Pretty Printing property. And this is going to allow us to format the JSON output that is written by the JSON Writer. So we'll just go ahead and set that to…

Contents