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.

Deserialization

Deserialization - Java EE Tutorial

From the course: Java EE 8 Essential Training

Start my 1-month free trial

Deserialization

- [Narrator] In this lesson, we're going to take a look at how JSON-B can deserialize JSON into a Java object. So, we're going to be working within our JMS consumer and it's going to receive a message containing JSON that corresponds with our order object. So, let's work to receive that JSON and deserialize it into an order. So, we'll start out once again by creating a JSON-B instance and you will remember we do that with the JSON-B builder and we'll use the create method once again. Now that we have our JSON-B object, once again, it's pretty simple, we're attempting to deserialize to an order, so we'll create an order object and then using JSON-B we can use the from JSON method and then we are going to retrieve the JSON from the JMS message. So, let's create a new string to hold that and all we need to do is, on the message, get the body and then the body expects us to provide a class that indicates the type of message we…

Contents