Questions tagged [jettison]

Jettison is a collection of Java APIs (like STaX and DOM) which read and write JSON.

Allows the creation of JSON based web services in frameworks like or XML serialization frameworks like .

There are currently two conventions for mapping JSON to XML.

  • BadgerFish which implements the full XML infoset in JSON using various techniques.
  • Mapped convention which allows you to manually map [tag:XML namespaces] to JSON element prefixes.

Jettison was initially developed for usage in XFire and CXF to enable JSON based services, later it also found its place in Java object serialization with XStream

Jettison Home Page

Jettison User Guide

99 questions
1
vote
1 answer

Jersey 1 to 2 Migration, using org.codehaus.jettison packages (MessageBodyWriter not found for media type=application/json)

Updating an OSGi/Spring web application to Jersey 2. Currently things are compiling and installing fine with Jersey 2, but I get this error when our resources are accessed: MessageBodyWriter not found for media type=application/json, type=class…
TRC
  • 13
  • 5
1
vote
1 answer

compare org.codehaus.jettison.json.JSONArray without regard to order

I've got 2 JSONArray full of integers. I want to compare them for equal content without regard for order. So: [1, 2] == [1, 2] TRUE [1, 2] == [2, 1] TRUE JSONArray has public boolean equals(Object o) but it returns FALSE for [1, 2] == [2,…
user1126515
  • 1,133
  • 3
  • 17
  • 34
1
vote
0 answers

Jettison can not convert json string to json object when there is an element has empty string value

My application is using camel rest (2.15.2) to catch a POST json String and then uses jettison to convert to a JSON Object. It is working fine with normal request. POST request: {"request"={"lname"="aaa", "fname"="bb"}} 1. String body =…
David
  • 3,538
  • 9
  • 39
  • 50
1
vote
0 answers

RESTEasy with jettison + swagger on WF9

we're using RESTEasy with jettison provider (not jackson because it doesn't support Atom links, that we really like) and try to create valid API documentation with Swagger. However, jettison generates json with "xmlRootElement", whereas swagger…
1
vote
2 answers

Jettison JSON/java , send list of string with json request

I am creating JSON object and send over the network , like org.codehaus.jettison.json.JSONObject json = new org.codehaus.jettison.json.JSONObject(); json.put("id", "15"); json.put("code", "secret"); …
Armen Arzumanyan
  • 1,939
  • 3
  • 30
  • 56
1
vote
0 answers

Configure Wildfly 8.1 to use Jettison

I have an interesting problem in that my Wildfly 8.1 installation is using Jackson (not Jackson 2) for marshalling classes to JSON. I would like to use Jettison in order to take advantage of the JAXB annotations I have in my classes. To force the…
Ollie
  • 91
  • 1
  • 9
1
vote
1 answer

Write json to text file, jettison

I have created a JSONOBject JSONObject features = new JSONObject(); which I want to store it in a txt file. I am using Jettison LIbrary for handling json files. However I didn't find a way to write json to file. Any idea?
Jose Ramon
  • 5,572
  • 25
  • 76
  • 152
1
vote
1 answer

Substituting java.lang.Object is bound to an anonymous type

I'm getting the error message: com.sun.istack.SAXException2: Instance of "com.kp.schema.Value" is substituting "java.lang.Object", but "com.kp.schema.Value" is bound to an anonymous type. I'm trying to Marshal Java objects to JSONObject using the…
Karthik Prasad
  • 9,662
  • 10
  • 64
  • 112
1
vote
0 answers

JAXB converts Java List to set of objects and thus loses list ordering

I have an XML schema for UI controls that looks something like the following XML ... ... ...
DaBlick
  • 898
  • 9
  • 21
1
vote
0 answers

How to get Spring MVC output using XStream to convert JSON to XML

I have a web application using Spring MVC (3.0.5) that outputs JSON using the HttpMessageConverter when the application/json is passed in Accept header. I want to output XML using XStream, but instead of the underlying Java object, I want to use the…
sunbiz
  • 193
  • 2
  • 6
1
vote
1 answer

JettisonMappedXmlDriver and pretty print with XStream

I'm doing serialization with XStream. For XML I use the StaxDriver and for JSON I use JettisonMappedXmlDriver: if (this.format == ISerializer.Format.JSON){ logger.info("json"); /* note: JsonHierarchicalStreamDriver can read Json only */ …
Rafa
  • 2,328
  • 3
  • 27
  • 44
1
vote
1 answer

JSON serialization with root element does not work in RestEasy/Jettison/JBossAS7

I am desperately looking for a way to make JSON serialization with root element to work on JBoss AS 7.1 with RestEasy and Jettison provider enabled. Although, according to RestEasy documentation, returning of the JSON root element should work, I…
1
vote
1 answer

Issue with unmarschelling json

i have a little ptoblem with a Jax-RS Webservice i created. Every time i post an Json-Object fitting the type "Beitrag" i get this error: SCHWERWIEGEND: The exception contained within MappableContainerException could not be mapped to a response,…
FredM
  • 41
  • 1
  • 2
  • 10
1
vote
1 answer

What is the best way of replace CXF's JSONProvider (Jettison based) with MOXy?

I was wondering why MOXy is not providing a JSONProvider class similar to JACKSON to replace the default JSON provider in a jax-rs implementation? This would be the easiest way to deal with all classes in a certain package. What I ended up doing was…
Behzad Pirvali
  • 764
  • 3
  • 10
  • 28
1
vote
1 answer

RestEasy Jettison/Jackson customization

I'm trying to use my objects with JAXB annotations for application/json output with my JAX-RS resource. I'm running on JBoss AS7 with RestEasy (both lastest versions - 7.1.1.Final and 2.3.4.Final). The issue is that I would like to customize my JSON…
zdenda.online
  • 2,451
  • 3
  • 23
  • 45