From the course: Java EE 8 Essential Training
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Serialization - Java EE Tutorial
From the course: Java EE 8 Essential Training
Serialization
- [Narrator] In this lesson we're going to see how we can use Json B to serialize a java object to its Json representation. So we're going to be working within our order resource, which is a Jax RS resource and on that resource we have a resource method named place order that accepts a post and that post expects a Json representation of an order object. So what's going to happen here is Jax RS is actually going to de-serialize the Json sent in the http request to the order java type. And then we're just going to kind of reverse that process with Json B and we'll serialize the order object to it's Json representation. So I'm going to go ahead and create a Json B object, so we can import that type, and then we create a Json B object using a Json builder. So you'll find that type and on it is a create method that creates a instance of Json B. Now once we have that Json B object, it is really simple. The Json B object has a two…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.