JSON Binding (original) (raw)

This section describes how to build and run the jsonbbasics example application. This example is a web application that demonstrates how to serialize an object to JSON and how to deserialize JSON to an object.

The jsonbbasics example application is in the_tut-install_/examples/web/jsonb/jsonbbasics directory.

The following topics are addressed here:

Components of the jsonbbasics Example Application

The jsonbbasics example application contains the following files.

Running the jsonbbasics Example Application

This section describes how to run the jsonbbasics example application from the command line using Maven.

To run the jsonbbasics example application using Maven:

  1. Make sure that GlassFish Server has been started (seeStarting and Stopping GlassFish Server).
  2. In a terminal window, go to:
tut-install/examples/web/jsonb/jsonbbasics  
  1. Enter the following command to deploy the application:
  2. Open a web browser window and enter the following address:
http://localhost:8080/jsonbbasics/  
  1. Enter data on form and click Serialize to JSON to submit the form. The following page shows the JSON format of the object data.
  2. Click Deserialize JSON. The index page displays and contains the fields populated from the object data.