Say I want to make the following JSON
{
\"key\" : \"1234\",
\"request\" : \"info\",
\"info\" : {
\"type\" : \"user\",
\"login\" :
If you work a lot with JSON data I would really recommend that you use Gson or Jackson. It's a lot more convenient and both of the libraries have very good support for converting to and from Java objects (which is a lot less messy and error prone than manually building your JSON through JSONObjects).