From Java to JSON

Creating a JSONObject from scratch

[Index |From Java to JSON ]

Creating a JSONObject from a JSON formatted string

[Index |From Java to JSON ]

Creating a JSONObject from a Map

[Index |From Java to JSON ]

Creating a JSONObject from a JavaBean

[Index |From Java to JSON ]

Creating a JSONArray from scratch

[Index |From Java to JSON ]

Creating a JSONArray from a JSON formatted string

[Index |From Java to JSON ]

Creating a JSONArray from a Collection

[Index |From Java to JSON ]

Creating a JSONArray from an array

[Index |From Java to JSON ]

JavaScript functions

[Index |From Java to JSON ]

Exclude properties

[Index |From Java to JSON ]

Exclude properties (with filters)

[Index |From Java to JSON ]

From JSON to Java

JSONObject to DynaBean

[Index |From JSON to Java ]

JSONObject to JavaBean

[Index |From JSON to Java ]

JSONArray to List

[Index |From JSON to Java ]

JSONArray to array

[Index |From JSON to Java ]

JSONArray to array (type conversion)

[Index |From JSON to Java ]

JSONObject to JavaBean, exclude properties with filters

[Index |From JSON to Java ]

From JSON to XML

JSONObject to XML

[Index |From JSON to XML ]

JSONObject to XML (no type hints)

[Index |From JSON to XML ]

JSONObject to XML (with json prefix)

[Index |From JSON to XML ]

JSONObject to XML (change node names)

[Index |From JSON to XML ]

JSONArray to XML

[Index |From JSON to XML ]

JSONArray to XML (no type hints)

[Index |From JSON to XML ]

JSONArray to XML (with json prefix)

[Index |From JSON to XML ]

Flatten JSONArray into parent

[Index |From JSON to XML ]

From XML to JSON

XML to JSONObject

[Index |From XML to JSON ]

Groovy Support

Using the JsonGroovyBuilder

The following snippets produce the same JSON output

[Index |Groovy Support ]

JRuby Support

Creating a JSONObject

[Index |JRuby Support ]

Append elements to JSONObject with << (array)

[Index |JRuby Support ]

Append elements to JSONObject with << (hash)

[Index |JRuby Support ]