public class AnotherArrayTest extends TestCase {
public void testAnotherSimpleXmlTypeBean() throws Exception {
final JSONJAXBContext ctx = new JSONJAXBContext(JSONConfiguration.mapped().arrays("cats").build(), AnotherArrayTestBean.class);
final JSONMarshaller jm = ctx.createJSONMarshaller();
final StringWriter sw = new StringWriter();
AnotherArrayTestBean one = new AnotherArrayTestBean();
Cat c1 = new Cat("Foo", "Kitty");
one.addCat(c1);
Cat c2 = new Cat("Bar", "Puss");
one.addCat(c2);
one.setProp("testProp");
final StringWriter sw1 = new StringWriter();
final JAXBContext jaxbContext = JAXBContext.newInstance(AnotherArrayTestBean.class);
final Marshaller marshaller = jaxbContext.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
marshaller.marshal(one, sw1);
final Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
final JAXBElement<AnotherArrayTestBean> unmarshal = unmarshaller.unmarshal(new StreamSource(new StringReader(sw1
.toString())), AnotherArrayTestBean.class);
marshaller.marshal(unmarshal, System.out);
jm.marshallToJSON(one, sw);
String jsonResult = sw.toString();
System.out.println(jsonResult);
String excpectedResult = "{\"cats\":[{\"name\":\"Foo\",\"nickName\":\"Kitty\"},{\"name\":\"Bar\",\"nickName\":\"Puss\"}],\"prop\":\"testProp\"}";
assertEquals(excpectedResult, jsonResult);