How to create simple JSON API, e.g. with Jetty? How to create simple JSON API, e.g. with Jetty? json json

How to create simple JSON API, e.g. with Jetty?


You have a very open question here.

To start with, Jetty is merely a Java Web Container (following a subset of the Java EE Web Profile), while it does have some AJAX/JSON capabilities, it is extremely fundamental and not hooked up into any sort of query API.

You would do better do use Jetty along with a proper REST/JSON API library for your project.

Some examples (these are not the only choices available):

Also note that there are many flavors of Java based JSON APIs and Libraries, you should probably be aware of them as you will encounter them in your journey to success.


In the end I found the Dropwizard framework (there might be others), which does a lot of the work that is necessary to get a simple JSON API up out of the box:

http://dropwizard.io/