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
24
votes
1 answer

how to force jettison to write an array, even if there is only one element in the array?

With the simplified example below: I get the following, as expected: {"person":{"name":"john","tags":["tag1","tag2"]}} However, if I only set one tag, I get this: {"person":{"name":"john","tags":"tag1"}} And I was expecting to get…
David Portabella
  • 12,390
  • 27
  • 101
  • 182
15
votes
2 answers

Difference between Jettison and Jackson in JBoss

What is the fundmental difference between using RestEasy JSON Provider Jettison (Badgerfish mapping) over Jackson? What is is pros and cons of using the one over the other?
Koekiebox
  • 5,793
  • 14
  • 53
  • 88
14
votes
4 answers

SimpleJson: String to JSONArray

I get the following JSON: [ { "user_id": "someValue" } ] It's saved inside a String. I would like to convert it to a JSONObject which fails (as the constructor assumes a JSON to start with {). As this doesn't seem to be possible I'd like to…
mosquito87
  • 4,270
  • 11
  • 46
  • 77
11
votes
2 answers

Jackson & Jettison usage in Jersey

Jersey framework uses both Jackson and Jettison libraries for JSON unmarshalling/marshalling. AFAIK, Jettison is for for mapping JSON to XML (with different mechanism support like mapped notation) and Jackson is for JSON generation/parsing (I'm…
manikanta
  • 8,100
  • 5
  • 59
  • 66
6
votes
2 answers

XML wrapped list to JSON array via Jettison and JAXB

I'm using JAXB to marshal an annotated object to XML in the form: Test A Test B I want to marshal this to JSON instead using JAXB (ala…
James
  • 1,237
  • 4
  • 22
  • 43
5
votes
3 answers

JSON parsing using Jettison

I am trying to parse JSON object using Jettison. This the code I'm using String s ="{\"appUsage\":[{\"appName\":\"ANDROID\",\"totalUsers\":\"0\"},{\"appName\":\"IOS\",\"totalUsers\":\"4\"}]}"; JSONObject obj = new…
prem
  • 163
  • 2
  • 3
  • 5
5
votes
1 answer

Ignoring null values when marshaling an object to JSON with RESTeasy and Jettison

When RESTeasy marshals a POJO into XML, it will skip null values by default: See Jaxb marshaller always writes xsi:nil (even when @XmlElement(required=false, nillable=true)). However, when marshaling to JSON, null properties are included. Is there…
Phyxx
  • 15,730
  • 13
  • 73
  • 112
5
votes
1 answer

Jettison / String returned as integer when marshalling

There's a 'feature' of Jettison, outlined in a JIRA entry way back in 2008, which refers to the following problem: Let's say I ask the value of "element" to be "00102"; the output may look like follows: { "Response": { "element": "00102"…
Ron
  • 254
  • 2
  • 17
5
votes
3 answers

Spring Batch, JdbcExecutionContextDao java.util.Map$Entry deserializer issue, xstream 1.4.1

I have a problem using Spring Batch 2.1.9: when i use jobExplorer.getJobExecution(jobExecutionId), i find a problem when DAO has to deserialize a string like: {"map":[{"entry":{"string":"parsedComparingDate","date":"2014-03-08 23:00:00.0…
Giuseppe Adaldo
  • 295
  • 3
  • 16
4
votes
3 answers

RESTEasy / Jettison, return Java object as JSON without the root node

I'm using RESTEasy to return Java objects as JSON objects (which is using Jettison Mapped Convention for JSON marshelling). But I don't want it to return the root node. For example @XmlRootElement public class Car{ private Integer id; …
Sam
  • 5,375
  • 2
  • 45
  • 54
4
votes
1 answer

Java Jersey Jettison Message Body Reader Exception

I am a complete beginner at REST services but I need to access some information via REST from a web site. The service has some sample code to show how to login that I have used. The sample code uses Jettison as a JSON parser but when I try to run…
hgus1294
  • 747
  • 14
  • 26
4
votes
2 answers

iOS app jettisoned with little resident memory usage evident

Sorry for the long post...I'm have a habit of being pretty verbose. :-P I have an odd problem with my iOS app that has been reported by users for several months now. I've looked into it a few times, but keep hitting a roadblock with it. The app is…
stuckj
  • 977
  • 1
  • 13
  • 24
4
votes
1 answer

Jettison JSON Automatically Changes Data Type

I'm using Resteasy 2.0.1.GA and thusly Resteasy-jettison-provider-1.2.GA and whenever I have a String property that contains all numbers (i.e. String test="1111";), the JSON response will display it as a number by removing the double quotes. If I…
c12
  • 9,557
  • 48
  • 157
  • 253
4
votes
2 answers

Jettison and JAXB Automatically Changes Data Type in JSON Response

I'm using Resteasy 2.0.1.GA and Resteasy-jettison-provider-1.2.GA with JAXB annontations and whenever I have a String property that contains all numbers (i.e. String groupName="1111";), the JSON response will display it as a number by removing the…
colin gray
  • 51
  • 1
  • 5
4
votes
3 answers

Remove JSON object from JSONArray - Jettison

Is there a direct way to remove an JSONObject stored in the JSONArray by using index. I tried all the possibilities. Still not able to remove the JSON object from the JSON Array. Any hint will be helpful Thanks
Timothy Rajan
  • 1,947
  • 8
  • 38
  • 62
1
2 3 4 5 6 7