labs / tiddlers / content / labs / lab07 / _Labs_07_JSON
@Mark George Mark George on 18 Aug 835 bytes WIP lab 7

As mentioned, Jooby is currently using the student's toString method. This is not so useful since we need the web service to return all of the student details in a nicely encoded format. JSON is the answer. If you aren't sure what JSON is then take a look at lecture 8.

Add the following to the server constructor just above where you added the product module, and fix the imports:

install(new GsonModule());

This adds the Gson module to the filter chain. Gson is an open source library created by Google that can convert domain objects to and from JSON (

Restart and test. You should now see a JSON representation of the products in the browser.

Note that the NetBeans generated toString methods produce output that looks a lot like JSON. It is sometimes hard to tell them apart.