adaptToJson

- [Instructor] So let us take a look at the demo now.…The first thing that we have to do is create…an adapter class which will implement…the JsonbAdapter interface.…And that's called a couple of methods…that we spoke about in the previous video.…So let's head back to the IDE.…And under the custom folder,…I'm going to create a class.…And let's call it CustomerAdapter…because that's the one I was trying to talk about.…The use cases and the customer object that I have,…I need to send out only two fields…as a part of serialization then, the serialization.…

So I'm going to write an adapter for that.…And what do you do on this?…You say implement JSONbAdapter.…That's the one.…So the JSONbAdapter is going to ask you…for two arguments in the javax syntax.…One is the original object which is the customer,…then the adapted object that you actually want…as a part of your requirement.…So the original object is the customer,…so let's import that, com.app.beans.…And the next one is, of course, going to be the JSON object.…

So what we do is we take the customer object,…

Resume Transcript Auto-Scroll

Author

Released

9/26/2018

JSON is the most popular format for data exchange. JSON-B is a standard binding layer for converting Java objects to and from JSON messages. It comes bundled with Java Enterprise Edition—containing all the features of third-party libraries without any of the integration effort. JSON-B defines a default mapping algorithm for converting existing Java classes to JSON, while enabling developers to customize the mapping process through the use of Java annotations. Learn default and customized mappings for JSON-B and see it in action in a JAX-RS web application, in this course with instructor and developer Ketkee Aryamane. Ketkee reviews all the features of JSON-B, including adapters and serializers, showing them in practice in real-world Java applications.