Convert JSON String To Java Object, Jettison Example

On this Jettison Example explains about converting a JSON string to java object Using Jettison JSON library

Jettison is a collection of Java APIs (like STaX and DOM) which read and write JSON. This allows nearly transparent enablement of JSON based web services in services frameworks like CXF or XML serialization frameworks like XStream

Reference ->

Here I am showing an example about How to convert a JSON string into Java Object using Jettison library.

Resolve CXF JSON Single Element Array Issue

Resolve CXF JSON Single Element Array Issue explains about How to resolve the issue on array serialization when using jettison library

Jettison is an open source java library for processing JSON format. It is the default library bundled with CXF framework, the problem with jettison is that if an array / list having multiple items jettison serialize the array correctly, but it have single item it will serialize incorrectly. you can see the below example

	length = 1: field = value
	length > 1: field = [value1, value2, ...]

you can see if it have one item enclosing bracket is missing. In order to avoid this issue, I am going to use Jackson library by replacing Jettison