Jackson – Convert Java object to JSON

In this Jackson tutorial we will see how to do data binding between Java object and Json , In the below example we can see how to Convert Java object to JSON. Let us have a look in to code example.

 

1. Java bean – POJO class.

 2. Test program to convert Java to Json.

 

NOTE : Please include the “jackson-all-1.8.2.jar” in class path to avoid errors.

 

OUTPUT:

Check the E: drive ,  bank.json will be created and the content would be like as below.

 

Posted in Json and tagged , .

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">