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
4
votes
3 answers

Jettison with json marshalling converting string data type to integer type, when value is numeric

We are using jettison-1.3.3 for converting JaxB to Json. We are facing an issue. whenever I have a String property that contains all numbers (i.e. String phone="12345";), the JSON response will display it as a number (12345) without having the…
user2365956
  • 41
  • 1
  • 2
4
votes
2 answers

JACKSON support for Java Generics?

Currently, I am working on a restFul project, which is schema based. So, we are using JAXB to do a XSD-->JAVA conversion. I have a class as follows: @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { …
Behzad Pirvali
  • 764
  • 3
  • 10
  • 28
3
votes
3 answers

Using Jettison to go from JSON to DOM in Java

So far, this is the story of a failure, and any advice is welcome. I tried the following: XMLStreamReader to Document using JAXP with Saxon The code: JSONObject obj = new JSONObject("{\"alice\":{\"bob\": \"a\"}}"); AbstractXMLStreamReader reader =…
avernet
  • 30,895
  • 44
  • 126
  • 163
3
votes
2 answers

Using jaxb to represent a list as the root element

How can we marshal/unmarshal the root element in a JSON that contains a list using JAXB? So it would the JSON as { "tag" : [ { "id" : "a", "id2": "aa" }, { "id" : "b", …
Hardy
  • 222
  • 2
  • 9
3
votes
1 answer

Could not deserialize multimap with XStream / Jettison

I'm trying to serialize and deserialize a guava's multimap using XStream and Jettison. Here's a simple test to illustrate: final XStream xstream = new XStream(new JettisonMappedXmlDriver()); final Multimap test =…
Joel
  • 2,374
  • 17
  • 26
3
votes
1 answer

Parsing JSON with Jettison

I want to use Jettison for parsing JSON responses for making them consistent in an XML format. So far, I couldn't get any further in the parsing part. I tried to apply this example JSONObject obj = new…
Pete
  • 502
  • 1
  • 6
  • 20
3
votes
1 answer

Resteasy Atom Links with Jackson instead of Jettison

Due to other requirements we need to use Jackson for JSON serialization. Unfortunately Jackson does not support Atom Links with RESTServiceDiscovery as stated in the documentation. Has anyone already build a workaround for this? Or any idea why it…
Leonard Brünings
  • 12,408
  • 1
  • 46
  • 66
3
votes
1 answer

Apache CXF Rest Client Clarity

My requirement is to use Apache CXF Rest Client API vendor has provided an url http://test.com Method: get Url: /getDetails Header set to application/json and parameter z=12345 And Response as JSON: { "hasMore": "true", "results": [ { …
Shiv Gopal
  • 539
  • 2
  • 10
  • 21
2
votes
1 answer

Parse/Encode JSON without Deserializing/Serializing classes

I'm looking for a JSON parser and encoder for .NET that can parse JSON into its own data structure which I can then navigate, as opposed to directly deserializing it into a class. In Java, I use Jettison's JSONObject and JSONArray which is dead easy…
Steve
  • 8,066
  • 11
  • 70
  • 112
2
votes
1 answer

How to get date in proper format from Json object in Java using jettison

Currently I am getting for Input: Date applicationDate; Output: 1318636800000 How do I format this date output properly?
amit sharma
  • 210
  • 2
  • 9
2
votes
0 answers

Non uniform output when serializing lists in com.thoughtworks.xstream Jettison JSON convertor

I'm having a real issue with the Java Jettison JSON package. For some reason, I'm getting a different representation for lists that are of length 1 and lists of length > 1. In the next example you can see I'm creating two List - one of length 1…
Ido Cohn
  • 1,685
  • 3
  • 21
  • 28
2
votes
1 answer

Mapping lists with jaxb on resteasy with jettison json provider

I have a method @GET @Produces("application/json") public List getMyConversations() { /* ... */ } The json output is something like [{"conversation" : { ... }}, {"conversation" : { ... }}] However, I'd like to output…
Adrian Rodriguez
  • 3,232
  • 2
  • 24
  • 34
2
votes
2 answers

POJO marshaller/demarshaller: JAX-RS JSON matched with GWT client JSON

I am using Resteasy and GWT. For certain reasons, as many others have similar motivations, I am not using GWT-RPC for some of the functionality of the software I am working on. I need to pass POJOs between GWT client and server by…
Blessed Geek
  • 21,058
  • 23
  • 106
  • 176
2
votes
1 answer

How to alter Jettison JSON format to exclude outer object wrapper?

I just started working in an environment (Java) that uses Jettison exclusively for marshalling (Object->JSON) and GSON for the unmarshalling (JSON->Object). I have been having problems unmarshalling JSON objects that were created with the Jettison…
piper1970
  • 518
  • 1
  • 3
  • 14
2
votes
1 answer

Infinite loop with Johnzon JSON serialization

I'm designing a very simple web app with a REST web service that utilizes JPA to interact with a PostgreSQL database and runs in TomEE. My JPA entities have bidirectional mappings and I want my REST service to consume/produce those JPA entities as…
Ed LaFave
  • 399
  • 3
  • 11