Mined Opinions For API: xstream

This tab contains all the opinions collected from Stack Overflow about the API. The other tabs present summaries of the opinions using different algorithms.
  • @hd1 : Thanks for the response.. details
  • XStream worked good for me; also, it returned better error messages when e.g.. details
  • This works fine in XStream but GSON seems to have issues (see above I edited my post).. details
  • @DeepakBala This seems a very good idea/alternative.. details
  • I found a way to fix this question:xstream.addImplicitCollection(this.getClass(), "mails", MailDto.class);Thank you!.. details
  • To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient [reputation]( URL_http://stackoverflow.com/help/whats-reputation ) you will be able to [comment on any post]( URL_http://stackoverflow.com/help/privileges/comment) .. details
  • a quick look at the xstream converters tutorial shows this example: "@XStreamConverter(value=BooleanConverter.class, booleans={false}, strings={"yes", "no"})".. details
  • I like XStream very much.. details
  • XStream worked good for me; also, it returned better error messages when e.g.. details
  • @DeepakBala This seems a very good idea/alternative.. details
  • This is a good alternative!.. details
  • Thank you!. details
  • I found a way to fix this question:xstream.addImplicitCollection(this.getClass(), "mails", MailDto.class);Thank you!.. details
  • I like XStream very much.. details
  • thanks.. details
  • To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient [reputation]( URL_http://stackoverflow.com/help/whats-reputation ) you will be able to [comment on any post]( URL_http://stackoverflow.com/help/privileges/comment) .. details
  • I tried Xstream as well but I was not able to .Btw the name of the xml tag will change Dynamically .. details
  • This is a good alternative!.. details
  • See JavaDoc - toXML: Serialize an object to a pretty-printed XML String.. details
  • Oops!. details
  • Correct answer to the wrong question - I'm just interested in XStream here, who's JettisonMappedXmlDriver is perfectly suited for JSON.. details
  • Well, the only way I see that can reproduce that JSON is by using the JsonHierarchicalStreamDriver with the DROP_ROOT mode activated.. details
  • @BorisStrandjev The docs for xstream make it look like it's primarily an xml serialization library with json format input/output retrofitted.. details
  • so... based on the example in your answer (and the tutorial), you are deserializing to a Product instead of a Map or something like that, which is exactly what I was referring to with the class hierarchy.. details
  • so... based on the example in your answer (and the tutorial), you are deserializing to a Product instead of a Map or something like that, which is exactly what I was referring to with the class hierarchy.. details
  • ... Or use xstream and don't mess with mirroring the data structure.... details
  • @ruack hey thanks buddy.But the object of Class A what i Have mentioned is not the root element.It is has a reference inside class C which supposed to be the root class.. details
  • The server will send back the correct type based on one of: the HTTP Accept header a "filetype extension", such as ".json" a querystring parameter, such as "format=json" .. details
  • Xstream 1.2.2 supports Java 1.4.. details
  • Use a third party library like XStream.. details
  • Can you please suggest some solution?. details
  • I've been thinking for these two JSON library: Google Gson JSON.Simple XStream Google Gson is pretty awesome, it can serialize class object that have no-args constructor.. details
  • Check out this tutorial on URL_http://xstream.codehaus.org/json-tutorial.html [JSON-and- Java] As a good practice, check whether your JSON is valid.. details
  • Check out this tutorial on URL_http://xstream.codehaus.org/json-tutorial.html [JSON-and- Java] As a good practice, check whether your JSON is valid.. details
  • I know its good to use gson or Xstream like things., but I need to do using Marshaller.How to achieve it?. details
  • thanks in advance!. details
  • By adding CODETERM7 to your enum, you now have a way to look up all the various enumerated values from the outside, by providing a CODETERM8 string.. details
  • Why are you using xstream for json support?. details
  • Thanks in advance!. details
  • I'd like the above JSON string to map back to a CODETERM7 , but I can't seem to figure out how to alias the class correctly: CODESNIPPET_JAVA3 .. details
  • I'll be dealing with a JSON string that might look like this: CODESNIPPET_JAVA1 .. details
  • But it can be used for JSON as well, look here URL_http://xstream.codehaus.org /json-tutorial.html [XStream-JSON-Tutorial] More libraries can be found here URL_http://www.json.org/ [ URL_http://www.json.org/ ] EDIT For displaying in HTML you can use Javascript: URL_http://msdn.microsoft.com /en-us/library/ie/cc836459%28v=vs.94%29.aspx [JSON.stringify- Function-(JavaScript)] CODESNIPPET_JAVA1 .. details
  • But I still need a way to configure a mapper to dynamically map such a CODETERM5 back to either a CODETERM6 or an CODETERM7 .. details
  • Configure XStream to dynamically map to different objects.. details
  • The only thing I can think of is first doing a String-replace like so: CODESNIPPET_JAVA7 .. details
  • One popular JSON-to-Java binding library is URL_http://jackson.codehaus.org/ [Jackson] One popular XML-to-Java binding library is URL_http://xstream.codehaus.org/ [XStream] If you intend to use this in a web application, maybe you would like to consider URL_http://static.springsource.org/spring/docs/current/spring- framework-reference/html/mvc.html [Spring-3-MVC] 's facilities for this.. details
  • Such an interface would be fairly simple to implement in GSON, XStream etc.. details
  • And you are decoupled from one of the many many XML or JSON libraries, so clients are freer to pick their favorite.. details
  • (added) None of the answers were what I really wanted ("yes, in javax.obscure.interfaces there's what you want") but thanks for the replies.. details
  • According to URL_http://xstream.codehaus.org/json-tutorial.html#json-dropping- root ["Write-to-JSON-with-the-self-contained-JSON-driver-dropping-the-root "-in-the-JSON-tutorial] , you can write something like this: CODESNIPPET_JAVA1 .. details
  • You can also use xStream for doing it which has got a very simple API.. details
  • Take a look at XStream: URL_http://xstream.codehaus.org/ [ URL_http://xstream.codehaus.org/ ] It's a lightweight library for xml and json serialization.. details
  • Sample xml would be helpful for sure.. details
  • The thing is that XStream is first and foremost designed to marshal and unmarshal Java objects to XML, JSON being just an afterthought, it most certainly has the least elegant support.. details
  • Luckily, the unnecessary list wrapper element is omitted in JSON: CODESNIPPET_JAVA2 .. details
  • Thanks in advance!Regards, Michael .. details
  • I'm using XStream 1.4.2, intialized like that: CODESNIPPET_JAVA3 .. details
  • The objects are very simple: CODESNIPPET_JAVA1 .. details
  • pretty-Print Writer does not suffice my needs.. details
  • pretty-Print Writer does not suffice my needs.. details
  • I now have a requirement to round the value to a given number of decimal places.. details
  • These were serializing fine.. details
  • Using XStream and JsonHierarchicalStreamDriver to output values, how do I round doubles?. details
  • Another converter is required, and this works well for the xml, but in json it renders the value as a string (i.e.. details
  • Thanks .. details
  • URL_http://stackoverflow.com/questions/6505532/formatting-decimal-values-for- xml [Formatting-decimal-values-for-XML] I am serializing objects to both xml and json.. details
  • yes , XML to JSON is easy but i need XSD to JSON Schema.. details
  • This library can help you do that: URL_http://xstream.codehaus.org/javadoc/com/thoughtworks/xstream/io/json/JsonH ierarchicalStreamDriver.html [ URL_http://xstream.codehaus.org/javadoc/com/thoughtw orks/xstream/io/json/JsonHierarchicalStreamDriver.html] Create yourself a reader using one of the factory methods: URL_http://xstream.codehaus.org/javadoc/com/thoughtworks/xstream/io/Hierarchic alStreamReader.html [ URL_http://xstream.codehaus.org/javadoc/com/thoughtworks/xstr eam/io/HierarchicalStreamReader.html] And then use the moveDown/moveUp methods to find the spot(s) of interest, and fish out your values.. details
  • Any help will be appreciated.. details
  • I feel like this should be easier than it seems.. details
  • I feel like converting a java hash to json hash should be straight forward.. details
  • I feel like this should be easier than it seems.. details
  • MOXy does look like a very promising candidate in XML space -- giving JAXB RI and XStream run for their money.. details
  • XStream, for example, is good for XML, but produces ugly JSON (and slowly at that).Going from XML to JSON is error-prone due to format impedance and I have yet to see an XML-processing lib that produces JSON clean JSON efficiently (or even just clean or efficiently).. details
  • I would use URL_http://xstream.codehaus.org/ [Xstream] which supports XML and JSon with mapping of data structures.. details
  • Thanks for the hint to this library but I suppose I won't give it a try.. details
  • Thanks for the hint to this library but I suppose I won't give it a try.. details
  • hey hi i didnt find in it can you give me link.. details
  • URL_http://xstream.codehaus.org/json-tutorial.html [xStream-has-some-JSON- support-built-in] , maybe you should try that and see what the result is.. details
  • I'm guessing CODETERM1 has a list of attributes, each pointing to their respective entity.. details
  • I like URL_http://jackson.codehaus.org/ [Jackson] for JSON, and URL_http://xstream.codehaus.org/ [XStream] for XML.. details
  • Update: @radai suggests the Simple XML library, which looks pretty interesting.. details
  • I would recommend URL_http://xstream.codehaus.org/ [XStream] as it can parse either.. details
  • I would recommend URL_http://xstream.codehaus.org/ [XStream] as it can parse either.. details
  • If you need to be able to manipulate your XML before it gets converted to JSON, or want fine-grained control of your representation, go with XStream.. details
  • For example, like this: CODESNIPPET_JAVA1 .. details
  • Properties p new Properties(); p.setProperty("a", "b"); p.setProperty("x", "y"); should be converted to: CODESNIPPET_JAVA1 .. details
  • You could use the Jettison driver with XStream to serialize / deserialize string <-> json : URL_http://xstream.codehaus.org/json-tutorial.html [ URL_http://xstream.codehaus.org/json-tutorial.html ] I had used this sometime back - there are some caveats on how the json schema should be for the parser to parse perfectly well.. details
  • It's like trying to escape URLs manually, instead of using URLEncode/Decode.... details
  • By manually I meant not by using a JSON library like Simple JSON, Gson, or XStream.. details
  • XStream is good for JSON: URL_http://xstream.codehaus.org/json-tutorial.html [ URL_http://xstream.codehaus.org/json-tutorial.html ] .. details
  • I actually have since used XStream which seemed to work well.. details
  • Actually, any XML package that can use Stax API can use Jettison -- JAXB does, so there's no extra work involved (same is mostly true for XStream too, although it may have some additional support).. details
  • The XStream library also supports JSON: URL_http://xstream.codehaus.org/json- tutorial.html [ URL_http://xstream.codehaus.org/json-tutorial.html ] .. details
  • I personally like URL_http://xstream.codehaus.org/json-tutorial.html [XStream] but there are many various implementations available.. details
  • However, when I have JSON string like the following CODESNIPPET_JAVA1 .. details
  • most notably it doesn't have a root node, I'm not sure how to parse it.. details
  • I am currently deserializing JSON using XStream, and it has been working great.. details
  • It looks like a conversation has been going about this, and it makes sense.. details
  • URL_http://simple.sourceforge.net/ [Simple] apparently can deal with more complex object graphs, but XStream seems more popular, does JSON and will probably suit my needs (I won't be ever having cyclic references).. details
  • So I would suggest just using XML, if going with XStream (which is a good tool for object serialization, that's what it's designed for).. details
  • Note however that XStream really is an XML-based object serializer; so while it does have JSON compatibility support, it goes through JSON->XML converter (Jettison) so any size or performance benefits JSON may have are lost.. details
  • Note however that XStream really is an XML-based object serializer; so while it does have JSON compatibility support, it goes through JSON->XML converter (Jettison) so any size or performance benefits JSON may have are lost.. details
  • How can I ask the XStream to disable the pretty printing?. details
  • How to disable pretty-printing(white space/newline) in XStream?. details
  • Both of them are pretty-printing (indenting) the output.. details
  • I agree with other poster in that XStream is not a good fit -- it's an OXM (Object/Xml Mapper), and JSON is handled as a secondary output format using XML processing path.. details
  • Does anyone have a suggestion for a good JSON Java object serialization that allows you to read/write arbitrary Java objects.. details
  • Intuitively I expect the XStream JSON to be serialized (and able to deserialize correctly) from the following format: CODESNIPPET_JAVA3 .. details
  • [EDIT Update issues using URL_http://code.google.com/p/google-gson/ [GSON] library]I attempted to use the URL_http://code.google.com/p/google-gson/ [GSON-library] but it cannot deserialize concrete objects when I only have it expect generic super classes (XStream and Jettison handles this because type information is baked into the serialization).. details
  • XStream is renowned for its ease of use and supports JSON: URL_http://xstream.codehaus.org/json-tutorial.html [ URL_http://xstream.codehaus.org/json-tutorial.html ] .. details
  • Apparently the CompactWriter works only for XML.. details
  • For POJO to XML I suggest using URL_http://www.oracle.com/technetwork/articles/javase/index-140168.html [JAXB] (there are other libraries as well, such as XStream for example, but JAXB is standardized).. details
  • I tried Xstream but found a variety of limitations with JsonHierarchicalStreamDriver and the JettisonMappedXmlDriver.1) The Stream driver cannot deserialize it can only serialize2) The mapped xml driver can do both but cannot produce pretty JSONIf one is ok with the above constraints, XSTREAM is a good choice.. details
  • Xstream supports serialization to JSON: URL_http://xstream.codehaus.org/json - tutorial.html.. details
  • It now supports JSON ouput.. details
  • Kind Regards .. details
  • To me, URL_http://xstream.codehaus.org/json-tutorial.html [the-best-Java -<->-JSON-parser-is-XStream] (yes, I'm really talking about json, not about xml).. details
  • XStream already deals with circular dependencies and has a simple and powerful api where you could write yours drivers, converters and so on.. details
  • XStream seems somewhat less flexible, and it's fairly slow.. details
  • I tried to solve your problem using XStream all the ways I could think of and I have failed.. details
  • XStream seems somewhat less flexible, and it's fairly slow.. details
  • I am sorry!.. details
  • Since escaping new lines / quotes etc can make this a little tricky, why not just use [XStream]( URL_http://xstream.codehaus.org /) to convert the object to XML and wrap the [HTML in a CDATA section]( URL_http://www.w3schools.com/xml/xml_cdata.asp ) ?. details
  • I tried to solve your problem using XStream all the ways I could think of and I have failed.. details
  • Thanks @atomman (+1) - Unofrtunately, this morning I realized that my JSON string at the top of my question was incorrect, so I edited it to reflect the actual (correct) JSON I'm dealing with.. details
  • you should use XStream annotation to omit the required field from result .. details
  • Here a code sample found on XStream implementation website ( URL_http://xstream.codehaus.org/json-tutorial.html [Xstream-website] ): CODESNIPPET_JAVA1 .. details
  • In the below format my doubt is the type mentioned with every field.. details
  • Since escaping new lines / quotes etc can make this a little tricky, why not just use URL_http://xstream.codehaus.org/ [XStream] to convert the object to XML and wrap the HTML in a CDATA section ?. details
  • Can xstream deserialize a complicated array?. details
  • May be you can choose another lib, refer to URL_http://json - lib.sourceforge.net/apidocs/jdk15/net/sf/json/JSONObject.html.. details
  • Tried XStream, but its giving me unwanted Element nodes which is not required in my xml.The converter in Json.org was close, but it creates only Text/node based XML and NOT creating attribute based.. details
  • But this seems like an ugly hack.. details
  • Unfortunately when I run this I get an exception, because I have CODETERM9 mapping CODETERM10 to 2 different Java objects: CODESNIPPET_JAVA6 .. details
  • Unfortunately, I cannot change the fact that this 3rd party REST service always sends back a CODETERM4 JSON result.. details
  • The technical problem being that as XStream must support both - XML and JSON formats, JSON map representation suffers, as there is no native way to represent a map-like structures in XML.. details
  • The technical problem being that as XStream must support both - XML and JSON formats, JSON map representation suffers, as there is no native way to represent a map-like structures in XML.. details
  • But unfortunately, only the last element is printed**.. details
  • What's wrong with my example?. details
  • XStream: Omit collection with XStreamImplicit.. details
  • And XML to JSON is not very valuable either, because it tends to produce "franken-JSON" which contains unnecessary non-JSON stuff (to retain XML namespace info, attribute/element distinction etc).. details
  • Using it I get the following json: {"simpleperson": { "name": "joe", "cars": ["Jag", "BMW"] }} When I use the same json to convert it back to an object using xstream.fromXML(json), I get the following exception: Exception in thread "main" com.thoughtworks.xstream.converters.reflection.Ab stractReflectionConverter$DuplicateFieldException: Duplicate field cars I cant figure out what is the problem.. details
  • I have a problem with XStream.. details
  • Using it I get the following json: {"simpleperson": { "name": "joe", "cars": ["Jag", "BMW"] }} When I use the same json to convert it back to an object using xstream.fromXML(json), I get the following exception: Exception in thread "main" com.thoughtworks.xstream.converters.reflection.Ab stractReflectionConverter$DuplicateFieldException: Duplicate field cars I cant figure out what is the problem.. details
  • Tools that can be used for converting from/to XML/JSON (e.g., URL_http://beckchr.github.com/staxon/ [StaxON] , URL_http://json- lib.sourceforge.net/ [JSON-lib] , URL_http://jettison.codehaus.org [Jettison] , URL_http://xstream.codehaus.org/ [XStream] ) do not seem to do that but only conversion of a known structure.. details
  • Converting XML to JSON is quite easy and can be done various ways: URL_http://answers.oreilly.com/topic/278-how-to-convert-xml-to-json-in-java [ URL_http://answers.oreilly.com/topic/278-how-to-convert-xml-to-json-in-java ] URL_http://www.json.org/javadoc/org/json/XML.html#toJSONObject%28java.lang.Str ing%29 [ URL_http://www.json.org/javadoc/org/json/XML.html toJSONObject%28java.lang .String%29] For converting from XML to JSON look at this maybe, seems to be very simple: URL_http://www.bramstein.com/projects/xsltjson/ [ URL_http://www.bramstein.com/projects/xsltjson/ ] URL_http://code.google.com/p/xml2json-xslt/ [ URL_http://code.google.com/p /xml2json-xslt/] URL_http://json-lib.sourceforge.net/index.html [ URL_http://json - lib.sourceforge.net/index.html] There is also URL_http://xstream.codehaus.org/ [ URL_http://xstream.codehaus.org/ ] library which allows you to make conversion in both sides (also to POJOs).. details
  • I have not found an easy generic solution using annotations or built in functionality in the above libraries but I have probably overlooked them.. details
  • I've looked into XStream, Eclipse MOXy, FlexJSON, JSON-lib & gson My goal is to get rid of my json wrapper classes and minimize code.. details
  • As of this writing, there are these 20: URL_http://www.JSON.org/java/index.html [org.json] URL_https://github.com/upictec/org.json.me/ [org.json.me] URL_http://jackson.codehaus.org/ [Jackson-JSON-Processor] URL_http://json-lib.sourceforge.net/ [Json-lib] URL_http://developer.berlios.de/projects/jsontools/ [JSON-Tools] URL_http://code.google.com/p/json-simple/ [json-simple] URL_http://www.stringtree.org/stringtree-json.html [Stringtree] URL_http://sojo.sourceforge.net/ [SOJO] URL_http://www.restlet.org/ [Restlet] URL_http://jettison.codehaus.org/ [Jettison] URL_http://json-taglib.sourceforge.net/ [json-taglib] URL_http://xstream.codehaus.org/ [XStream] URL_http://code.google.com/p/jsonmarshaller/ [JsonMarshaller] URL_http://flexjson.sourceforge.net/ [Flexjson] URL_http://sourceforge.net/projects/jontools/ [JON-tools] URL_http://code.google.com/p/google-gson/ [google-gson] URL_http://argo.sourceforge.net/ [Argo] URL_http://pivot.apache.org/ [Pivot] URL_http://jwm.slavitica.net/p/projects/jsonij [jsonij] URL_http://sourceforge.net/projects/fastjson/ [fastjson] ...but of course the list can change.. details
  • POJO (DTO): CODESNIPPET_JAVA2 .. details
  • It is not easy with XStream, because XStream first marshals the CODETERM1 object into intermediary XML before converting the XML to JSON and getting the XML just right is hard.. details
  • Sorry.. details
  • A small price to pay (ugly json) for true serialization.. details
  • parsing xml is more expensive than JSON in this case.. details
  • parsing xml is more expensive than JSON in this case.. details
  • FWIW, XStream with Badgerfish (jettison) does handle them (since it's full object-serialization framework, although resulting json looks ugly, as its xml based, just converts to json via badgerfish).. details
  • URL_http://xstream.codehaus.org/ [XStream] has a URL_http://xstream.codehaus.org/javadoc/com/thoughtworks/xstream/io/json /package-summary.html [JSON-serializer-and-deserializer] for arbitrary Java objects.. details
  • For example this fails: CODESNIPPET_JAVA1 .. details
  • The trouble may be caused by it using the XStream XML URL_http://xstream.codehaus.org/converters.html [CollectionConverter] ?. details
  • I want to be able to create a list of objects to send to the server and be properly marshalled into Java but the format that XStream and JSON expect it in is very non-intuitive and requires our javascript libraries to jump through hoops.. details
  • Yes, this is a big problem, and is rather hard to solve.. details
  • Yes, this is a big problem, and is rather hard to solve.. details
  • Works nicely with Jersey, and I am use it myself (current Jersey version does not bundle full Pojo data binding by default, but will in near future) I would actually not use any of xml libs to produce "json": XStream and JAXB/Jettison can produce kind of JSON, but it uses ugly conventions that are rather non-intuitive.. details
Summaries the opinions about xstream using topic modeling.
  • 0. root tutorial write format converter manually hey simple serialize driver: 26
    • Thank you!. details
    • I like XStream very much.. details
    • Oops!. details
    • a quick look at the xstream converters tutorial shows this example: "@XStreamConverter(value=BooleanConverter.class, booleans={false}, strings={"yes", "no"})".. details
    • thanks.. details
    • This is a good alternative!.. details
    • @ruack hey thanks buddy.But the object of Class A what i Have mentioned is not the root element.It is has a reference inside class C which supposed to be the root class.. details
    • The server will send back the correct type based on one of: the HTTP Accept header a "filetype extension", such as ".json" a querystring parameter, such as "format=json" .. details
    • Xstream 1.2.2 supports Java 1.4.. details
    • Why are you using xstream for json support?. details
    • According to root ["Write-to-JSON-with-the-self-contained-JSON-driver-dropping-the-root "-in-the-JSON-tutorial] , you can write something like this: CODESNIPPET .. details
    • Sample xml would be helpful for sure.. details
    • The thing is that XStream is first and foremost designed to marshal and unmarshal Java objects to XML, JSON being just an afterthought, it most certainly has the least elegant support.. details
    • Thanks .. details
    • Another converter is required, and this works well for the xml, but in json it renders the value as a string (i.e.. details
    • yes , XML to JSON is easy but i need XSD to JSON Schema.. details
    • Any help will be appreciated.. details
    • hey hi i didnt find in it can you give me link.. details
    • I would recommend XStream as it can parse either.. details
    • For example, like this: CODESNIPPET .. details
    • It's like trying to escape URLs manually, instead of using URLEncode/Decode.... details
    • XStream is good for JSON: .. details
    • I actually have since used XStream which seemed to work well.. details
    • Intuitively I expect the XStream JSON to be serialized (and able to deserialize correctly) from the following format: CODESNIPPET .. details
    • XStream is renowned for its ease of use and supports JSON: .. details
    • It now supports JSON ouput.. details
  • 1. simple root tutorial find jsonhierarchicalstreamdriver mode maildto question round gson: 7
    • I found a way to fix this question:xstream.addImplicitCollection(this.getClass(), "mails", MailDto.class);Thank you!.. details
    • Well, the only way I see that can reproduce that JSON is by using the JsonHierarchicalStreamDriver with the DROP_ROOT mode activated.. details
    • Check out this tutorial on JSON-and- Java] As a good practice, check whether your JSON is valid.. details
    • Such an interface would be fairly simple to implement in GSON, XStream etc.. details
    • I now have a requirement to round the value to a given number of decimal places.. details
    • However, when I have JSON string like the following CODESNIPPET .. details
    • It looks like a conversation has been going about this, and it makes sense.. details
  • 2. format write produce serialize html simple deal output driver doc: 9
    • See JavaDoc - toXML: Serialize an object to a pretty-printed XML String.. details
    • @BorisStrandjev The docs for xstream make it look like it's primarily an xml serialization library with json format input/output retrofitted.. details
    • Thanks in advance!Regards, Michael .. details
    • These were serializing fine.. details
    • XStream, for example, is good for XML, but produces ugly JSON (and slowly at that).Going from XML to JSON is error-prone due to format impedance and I have yet to see an XML-processing lib that produces JSON clean JSON efficiently (or even just clean or efficiently).. details
    • If you need to be able to manipulate your XML before it gets converted to JSON, or want fine-grained control of your representation, go with XStream.. details
    • Does anyone have a suggestion for a good JSON Java object serialization that allows you to read/write arbitrary Java objects.. details
    • XStream already deals with circular dependencies and has a simple and powerful api where you could write yours drivers, converters and so on.. details
    • To me, the-best-Java -<->-JSON-parser-is-XStream] (yes, I'm really talking about json, not about xml).. details
  • 3. tutorial simple html edit gson space printing root deserializing deal: 17
    • This works fine in XStream but GSON seems to have issues (see above I edited my post).. details
    • so... based on the example in your answer (and the tutorial), you are deserializing to a Product instead of a Map or something like that, which is exactly what I was referring to with the class hierarchy.. details
    • I know its good to use gson or Xstream like things., but I need to do using Marshaller.How to achieve it?. details
    • But it can be used for JSON as well, look here /json-tutorial.html [XStream-JSON-Tutorial] More libraries can be found here EDIT For displaying in HTML you can use Javascript: /en-us/library/ie/cc836459%28v=vs.94%29.aspx [JSON.stringify- Function-(JavaScript)] CODESNIPPET .. details
    • And you are decoupled from one of the many many XML or JSON libraries, so clients are freer to pick their favorite.. details
    • You can also use xStream for doing it which has got a very simple API.. details
    • The objects are very simple: CODESNIPPET .. details
    • MOXy does look like a very promising candidate in XML space -- giving JAXB RI and XStream run for their money.. details
    • Update: @radai suggests the Simple XML library, which looks pretty interesting.. details
    • By manually I meant not by using a JSON library like Simple JSON, Gson, or XStream.. details
    • The XStream library also supports JSON: tutorial.html [ .. details
    • I am currently deserializing JSON using XStream, and it has been working great.. details
    • Simple apparently can deal with more complex object graphs, but XStream seems more popular, does JSON and will probably suit my needs (I won't be ever having cyclic references).. details
    • How to disable pretty-printing(white space/newline) in XStream?. details
    • How can I ask the XStream to disable the pretty printing?. details
    • Xstream supports serialization to JSON: - tutorial.html.. details
    • Kind Regards .. details
  • 4. gson jettison hash feel update deserialize edit expect concrete bake: 11
    • Correct answer to the wrong question - I'm just interested in XStream here, who's JettisonMappedXmlDriver is perfectly suited for JSON.. details
    • Use a third party library like XStream.. details
    • Can you please suggest some solution?. details
    • By adding getMyStateByDesc(String) to your enum, you now have a way to look up all the various enumerated values from the outside, by providing a desc string.. details
    • The only thing I can think of is first doing a String-replace like so: CODESNIPPET .. details
    • I'm using XStream 1.4.2, intialized like that: CODESNIPPET .. details
    • I feel like converting a java hash to json hash should be straight forward.. details
    • I feel like this should be easier than it seems.. details
    • Actually, any XML package that can use Stax API can use Jettison -- JAXB does, so there's no extra work involved (same is mostly true for XStream too, although it may have some additional support).. details
    • most notably it doesn't have a root node, I'm not sure how to parse it.. details
    • [EDIT Update issues using GSON library]I attempted to use the GSON-library but it cannot deserialize concrete objects when I only have it expect generic super classes (XStream and Jettison handles this because type information is baked into the serialization).. details
  • 5. dynamically configure response fruit mapper employee printing output alias figure: 9
    • XStream worked good for me; also, it returned better error messages when e.g.. details
    • I tried Xstream as well but I was not able to .Btw the name of the xml tag will change Dynamically .. details
    • I'd like the above JSON string to map back to a Widget , but I can't seem to figure out how to alias the class correctly: CODESNIPPET .. details
    • Configure XStream to dynamically map to different objects.. details
    • But I still need a way to configure a mapper to dynamically map such a response back to either a Fruit or an Employee .. details
    • Luckily, the unnecessary list wrapper element is omitted in JSON: CODESNIPPET .. details
    • xStream-has-some-JSON- support-built-in] , maybe you should try that and see what the result is.. details
    • I personally like XStream but there are many various implementations available.. details
    • Both of them are pretty-printing (indenting) the output.. details
  • 6. html dynamically output format mapper oxm secondary agree poster fit: 7
    • ... Or use xstream and don't mess with mirroring the data structure.... details
    • I'll be dealing with a JSON string that might look like this: CODESNIPPET .. details
    • (added) None of the answers were what I really wanted ("yes, in javax.obscure.interfaces there's what you want") but thanks for the replies.. details
    • Take a look at XStream: It's a lightweight library for xml and json serialization.. details
    • This library can help you do that: ierarchicalStreamDriver.html [ orks/xstream/io/json/JsonHierarchicalStreamDriver.html Create yourself a reader using one of the factory methods: alStreamReader.html [ eam/io/HierarchicalStreamReader.html And then use the moveDown/moveUp methods to find the spot(s) of interest, and fish out your values.. details
    • I like Jackson for JSON, and XStream for XML.. details
    • I agree with other poster in that XStream is not a good fit -- it's an OXM (Object/Xml Mapper), and JSON is handled as a secondary output format using XML processing path.. details
  • 7. setproperty property jaxb standardize pojo writer print hd1 idea response: 9
    • @DeepakBala This seems a very good idea/alternative.. details
    • @hd1 : Thanks for the response.. details
    • thanks in advance!. details
    • Thanks in advance!. details
    • pretty-Print Writer does not suffice my needs.. details
    • pretty-Print Writer does not suffice my needs.. details
    • Properties p new Properties(); p.setProperty("a", "b"); p.setProperty("x", "y"); should be converted to: CODESNIPPET .. details
    • Apparently the CompactWriter works only for XML.. details
    • For POJO to XML I suggest using JAXB (there are other libraries as well, such as XStream for example, but JAXB is standardized).. details
  • 8. post comment driver html gson binding deserialize mvc serialize jettison: 8
    • To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient [reputation]( ) you will be able to [comment on any post]( .. details
    • I've been thinking for these two JSON library: Google Gson JSON.Simple XStream Google Gson is pretty awesome, it can serialize class object that have no-args constructor.. details
    • One popular JSON-to-Java binding library is Jackson One popular XML-to-Java binding library is XStream If you intend to use this in a web application, maybe you would like to consider framework-reference/html/mvc.html [Spring-3-MVC] 's facilities for this.. details
    • Thanks for the hint to this library but I suppose I won't give it a try.. details
    • You could use the Jettison driver with XStream to serialize / deserialize string <-> json : I had used this sometime back - there are some caveats on how the json schema should be for the parser to parse perfectly well.. details
    • Note however that XStream really is an XML-based object serializer; so while it does have JSON compatibility support, it goes through JSON->XML converter (Jettison) so any size or performance benefits JSON may have are lost.. details
    • So I would suggest just using XML, if going with XStream (which is a good tool for object serialization, that's what it's designed for).. details
    • I tried Xstream but found a variety of limitations with JsonHierarchicalStreamDriver and the JettisonMappedXmlDriver.1) The Stream driver cannot deserialize it can only serialize2) The mapped xml driver can do both but cannot produce pretty JSONIf one is ok with the above constraints, XSTREAM is a good choice.. details
  • 9. entity output respective attribute serializing jsonhierarchicalstreamdriver guess point round double: 4
    • xml [Formatting-decimal-values-for-XML] I am serializing objects to both xml and json.. details
    • Using XStream and JsonHierarchicalStreamDriver to output values, how do I round doubles?. details
    • I would use Xstream which supports XML and JSon with mapping of data structures.. details
    • I'm guessing Entity has a list of attributes, each pointing to their respective entity.. details
  • 0. html wrap escape cdata quote response exception mapping alias solve: 3
    • Since escaping new lines / quotes etc can make this a little tricky, why not just use [XStream]( /) to convert the object to XML and wrap the [HTML in a CDATA section]( ) ?. details
    • Since escaping new lines / quotes etc can make this a little tricky, why not just use XStream to convert the object to XML and wrap the HTML in a CDATA section ?. details
    • Unfortunately when I run this I get an exception, because I have xs.alias("response", ...) mapping response to 2 different Java objects: CODESNIPPET .. details
  • 1. produce jersey gson minimize wrapper flexjson eclipse rid moxy util: 3
    • I've looked into XStream, Eclipse MOXy, FlexJSON, JSON-lib & gson My goal is to get rid of my json wrapper classes and minimize code.. details
    • It is not easy with XStream, because XStream first marshals the java.util.Properties object into intermediary XML before converting the XML to JSON and getting the XML just right is hard.. details
    • Works nicely with Jersey, and I am use it myself (current Jersey version does not bundle full Pojo data binding by default, but will in near future) I would actually not use any of xml libs to produce "json": XStream and JAXB/Jettison can produce kind of JSON, but it uses ugly conventions that are rather non-intuitive.. details
  • 2. html create require format marshal lang pojos reflect side actual: 5
    • Thanks @atomman (+1) - Unofrtunately, this morning I realized that my JSON string at the top of my question was incorrect, so I edited it to reflect the actual (correct) JSON I'm dealing with.. details
    • Converting XML to JSON is quite easy and can be done various ways: ing%29 [ toJSONObject%28java.lang .String%29] For converting from XML to JSON look at this maybe, seems to be very simple: /xml2json-xslt/ - lib.sourceforge.net/index.html] There is also library which allows you to make conversion in both sides (also to POJOs).. details
    • A small price to pay (ugly json) for true serialization.. details
    • XStream has a /package-summary.html [JSON-serializer-and-deserializer] for arbitrary Java objects.. details
    • I want to be able to create a list of objects to send to the server and be properly marshalled into Java but the format that XStream and JSON expect it in is very non-intuitive and requires our javascript libraries to jump through hoops.. details
  • 3. tools jettison change simple jsonmarshaller jsonij flexjson taglib jon gson: 3
    • May be you can choose another lib, refer to - lib.sourceforge.net/apidocs/jdk15/net/sf/json/JSONObject.html.. details
    • XStream: Omit collection with XStreamImplicit.. details
    • As of this writing, there are these 20: org.json org.json.me Jackson-JSON-Processor Json-lib JSON-Tools json-simple Stringtree SOJO Restlet Jettison json-taglib XStream JsonMarshaller Flexjson JON-tools google-gson Argo Pivot jsonij fastjson ...but of course the list can change.. details
  • 4. produce attribute franken stuff retain namespace tend info technical structure: 5
    • I tried to solve your problem using XStream all the ways I could think of and I have failed.. details
    • The technical problem being that as XStream must support both - XML and JSON formats, JSON map representation suffers, as there is no native way to represent a map-like structures in XML.. details
    • But unfortunately, only the last element is printed**.. details
    • And XML to JSON is not very valuable either, because it tends to produce "franken-JSON" which contains unnecessary non-JSON stuff (to retain XML namespace info, attribute/element distinction etc).. details
    • Yes, this is a big problem, and is rather hard to solve.. details
  • 5. result car exception follow response change party fact send 3rd: 6
    • you should use XStream annotation to omit the required field from result .. details
    • Unfortunately, I cannot change the fact that this 3rd party REST service always sends back a { "response": { ... } } JSON result.. details
    • Using it I get the following json: {"simpleperson": { "name": "joe", "cars": ["Jag", "BMW"] }} When I use the same json to convert it back to an object using xstream.fromXML(json), I get the following exception: Exception in thread "main" com.thoughtworks.xstream.converters.reflection.Ab stractReflectionConverter$DuplicateFieldException: Duplicate field cars I cant figure out what is the problem.. details
    • Tools that can be used for converting from/to XML/JSON (e.g., StaxON , lib.sourceforge.net/ [JSON-lib] , Jettison , XStream ) do not seem to do that but only conversion of a known structure.. details
    • POJO (DTO): CODESNIPPET .. details
    • parsing xml is more expensive than JSON in this case.. details
  • 6. base badgerfish find website create node result jettison fwiw full: 14
    • XStream seems somewhat less flexible, and it's fairly slow.. details
    • I am sorry!.. details
    • Here a code sample found on XStream implementation website ( Xstream-website ): CODESNIPPET .. details
    • In the below format my doubt is the type mentioned with every field.. details
    • Can xstream deserialize a complicated array?. details
    • Tried XStream, but its giving me unwanted Element nodes which is not required in my xml.The converter in Json.org was close, but it creates only Text/node based XML and NOT creating attribute based.. details
    • But this seems like an ugly hack.. details
    • What's wrong with my example?. details
    • I have a problem with XStream.. details
    • I have not found an easy generic solution using annotations or built in functionality in the above libraries but I have probably overlooked them.. details
    • Sorry.. details
    • FWIW, XStream with Badgerfish (jettison) does handle them (since it's full object-serialization framework, although resulting json looks ugly, as its xml based, just converts to json via badgerfish).. details
    • The trouble may be caused by it using the XStream XML CollectionConverter ?. details
    • For example this fails: CODESNIPPET .. details
Summaries of the opinions about xstream using three algorithms (Textrank, Lexrank and Luhn) adopted from extractive summarization. Each algorithm was used once for the positive opinions and once for the negative opinions.
  • so based on the example in your answer (and the tutorial), you are deserializing to a Product instead of a Map or something like that, which is exactly what I was referring to with the class hierarchy .
  • So I would suggest just using XML, if going with XStream (which is a good tool for object serialization, that's what it's designed for) .
  • The objects are very simple: CODESNIPPET JAVA1 .
  • I like Jackson for JSON, and XStream for XML .
  • @ruack hey thanks buddy But the object of Class A what i Have mentioned is not the root element It is has a reference inside class C which supposed to be the root class .
  • For POJO to XML I suggest using JAXB (there are other libraries as well, such as XStream for example, but JAXB is standardized) .
  • You could use the Jettison driver with XStream to serialize deserialize string < > json : I had used this sometime back there are some caveats on how the json schema should be for the parser to parse perfectly well .
  • XStream is good for JSON: .
  • xml Formatting decimal values for XML I am serializing objects to both xml and json .
  • Another converter is required, and this works well for the xml, but in json it renders the value as a string (i e .
  • so based on the example in your answer (and the tutorial), you are deserializing to a Product instead of a Map or something like that, which is exactly what I was referring to with the class hierarchy .
  • I'd like the above JSON string to map back to a Widget , but I can't seem to figure out how to alias the class correctly: CODESNIPPET JAVA3 .
  • This library can help you do that: ierarchicalStreamDriver html orks xstream io json JsonHierarchicalStreamDriver html Create yourself a reader using one of the factory methods: alStreamReader html eam io HierarchicalStreamReader html And then use the moveDown moveUp methods to find the spot(s) of interest, and fish out your values .
  • According to root "Write to JSON with the self contained JSON driver dropping the root " in the JSON tutorial , you can write something like this: CODESNIPPET JAVA1 .
  • @ruack hey thanks buddy But the object of Class A what i Have mentioned is not the root element It is has a reference inside class C which supposed to be the root class .
  • XStream, for example, is good for XML, but produces ugly JSON (and slowly at that) Going from XML to JSON is error prone due to format impedance and I have yet to see an XML processing lib that produces JSON clean JSON efficiently (or even just clean or efficiently) .
  • I tried Xstream but found a variety of limitations with JsonHierarchicalStreamDriver and the JettisonMappedXmlDriver 1) The Stream driver cannot deserialize it can only serialize2) The mapped xml driver can do both but cannot produce pretty JSONIf one is ok with the above constraints, XSTREAM is a good choice .
  • One popular JSON to Java binding library is Jackson One popular XML to Java binding library is XStream If you intend to use this in a web application, maybe you would like to consider framework reference html mvc html Spring 3 MVC 's facilities for this .
  • You could use the Jettison driver with XStream to serialize deserialize string < > json : I had used this sometime back there are some caveats on how the json schema should be for the parser to parse perfectly well .
  • EDIT Update issues using GSON library]I attempted to use the GSON library but it cannot deserialize concrete objects when I only have it expect generic super classes (XStream and Jettison handles this because type information is baked into the serialization) .
  • so based on the example in your answer (and the tutorial), you are deserializing to a Product instead of a Map or something like that, which is exactly what I was referring to with the class hierarchy .
  • So I would suggest just using XML, if going with XStream (which is a good tool for object serialization, that's what it's designed for) .
  • This library can help you do that: ierarchicalStreamDriver html orks xstream io json JsonHierarchicalStreamDriver html Create yourself a reader using one of the factory methods: alStreamReader html eam io HierarchicalStreamReader html And then use the moveDown moveUp methods to find the spot(s) of interest, and fish out your values .
  • @ruack hey thanks buddy But the object of Class A what i Have mentioned is not the root element It is has a reference inside class C which supposed to be the root class .
  • XStream, for example, is good for XML, but produces ugly JSON (and slowly at that) Going from XML to JSON is error prone due to format impedance and I have yet to see an XML processing lib that produces JSON clean JSON efficiently (or even just clean or efficiently) .
  • I tried Xstream but found a variety of limitations with JsonHierarchicalStreamDriver and the JettisonMappedXmlDriver 1) The Stream driver cannot deserialize it can only serialize2) The mapped xml driver can do both but cannot produce pretty JSONIf one is ok with the above constraints, XSTREAM is a good choice .
  • One popular JSON to Java binding library is Jackson One popular XML to Java binding library is XStream If you intend to use this in a web application, maybe you would like to consider framework reference html mvc html Spring 3 MVC 's facilities for this .
  • You could use the Jettison driver with XStream to serialize deserialize string < > json : I had used this sometime back there are some caveats on how the json schema should be for the parser to parse perfectly well .
  • But it can be used for JSON as well, look here json tutorial html XStream JSON Tutorial More libraries can be found here EDIT For displaying in HTML you can use Javascript: en us library ie cc836459%28v=vs 94%29 aspx JSON stringify Function (JavaScript) CODESNIPPET JAVA1 .
  • EDIT Update issues using GSON library]I attempted to use the GSON library but it cannot deserialize concrete objects when I only have it expect generic super classes (XStream and Jettison handles this because type information is baked into the serialization) .
  • I have a problem with XStream .
  • Thanks @atomman ( 1) Unofrtunately, this morning I realized that my JSON string at the top of my question was incorrect, so I edited it to reflect the actual (correct) JSON I'm dealing with .
  • Unfortunately when I run this I get an exception, because I have xs.alias("response", ...) mapping response to 2 different Java objects: CODESNIPPET JAVA6 .
  • FWIW, XStream with Badgerfish (jettison) does handle them (since it's full object serialization framework, although resulting json looks ugly, as its xml based, just converts to json via badgerfish) .
  • Works nicely with Jersey, and I am use it myself (current Jersey version does not bundle full Pojo data binding by default, but will in near future) I would actually not use any of xml libs to produce "json": XStream and JAXB Jettison can produce kind of JSON, but it uses ugly conventions that are rather non intuitive .
  • It is not easy with XStream, because XStream first marshals the java.util.Properties object into intermediary XML before converting the XML to JSON and getting the XML just right is hard .
  • Converting XML to JSON is quite easy and can be done various ways: ing%29 toJSONObject%28java lang String%29 For converting from XML to JSON look at this maybe, seems to be very simple: xml2json xslt lib sourceforge net index html There is also library which allows you to make conversion in both sides (also to POJOs) .
  • Tools that can be used for converting from to XML JSON (e g , StaxON , lib sourceforge net JSON lib , Jettison , XStream ) do not seem to do that but only conversion of a known structure .
  • I tried to solve your problem using XStream all the ways I could think of and I have failed .
  • I want to be able to create a list of objects to send to the server and be properly marshalled into Java but the format that XStream and JSON expect it in is very non intuitive and requires our javascript libraries to jump through hoops .
  • Using it I get the following json: {"simpleperson": { "name": "joe", "cars": "Jag", "BMW" }} When I use the same json to convert it back to an object using xstream fromXML(json), I get the following exception: Exception in thread "main" com thoughtworks xstream converters reflection Ab stractReflectionConverter$DuplicateFieldException: Duplicate field cars I cant figure out what is the problem .
  • Thanks @atomman ( 1) Unofrtunately, this morning I realized that my JSON string at the top of my question was incorrect, so I edited it to reflect the actual (correct) JSON I'm dealing with .
  • As of this writing, there are these 20: org json org json me Jackson JSON Processor Json lib JSON Tools json simple Stringtree SOJO Restlet Jettison json taglib XStream JsonMarshaller Flexjson JON tools google gson Argo Pivot jsonij fastjson but of course the list can change .
  • Works nicely with Jersey, and I am use it myself (current Jersey version does not bundle full Pojo data binding by default, but will in near future) I would actually not use any of xml libs to produce "json": XStream and JAXB Jettison can produce kind of JSON, but it uses ugly conventions that are rather non intuitive .
  • It is not easy with XStream, because XStream first marshals the java.util.Properties object into intermediary XML before converting the XML to JSON and getting the XML just right is hard .
  • Converting XML to JSON is quite easy and can be done various ways: ing%29 toJSONObject%28java lang String%29 For converting from XML to JSON look at this maybe, seems to be very simple: xml2json xslt lib sourceforge net index html There is also library which allows you to make conversion in both sides (also to POJOs) .
  • And XML to JSON is not very valuable either, because it tends to produce "franken JSON" which contains unnecessary non JSON stuff (to retain XML namespace info, attribute element distinction etc) .
  • Since escaping new lines quotes etc can make this a little tricky, why not just use XStream to convert the object to XML and wrap the HTML in a CDATA section ?.
  • Since escaping new lines quotes etc can make this a little tricky, why not just use XStream]( ) to convert the object to XML and wrap the HTML in a CDATA section]( ) ?.
  • I want to be able to create a list of objects to send to the server and be properly marshalled into Java but the format that XStream and JSON expect it in is very non intuitive and requires our javascript libraries to jump through hoops .
  • Using it I get the following json: {"simpleperson": { "name": "joe", "cars": "Jag", "BMW" }} When I use the same json to convert it back to an object using xstream fromXML(json), I get the following exception: Exception in thread "main" com thoughtworks xstream converters reflection Ab stractReflectionConverter$DuplicateFieldException: Duplicate field cars I cant figure out what is the problem .
  • Tried XStream, but its giving me unwanted Element nodes which is not required in my xml The converter in Json org was close, but it creates only Text node based XML and NOT creating attribute based .
  • FWIW, XStream with Badgerfish (jettison) does handle them (since it's full object serialization framework, although resulting json looks ugly, as its xml based, just converts to json via badgerfish) .
  • Works nicely with Jersey, and I am use it myself (current Jersey version does not bundle full Pojo data binding by default, but will in near future) I would actually not use any of xml libs to produce "json": XStream and JAXB Jettison can produce kind of JSON, but it uses ugly conventions that are rather non intuitive .
  • It is not easy with XStream, because XStream first marshals the java.util.Properties object into intermediary XML before converting the XML to JSON and getting the XML just right is hard .
  • Converting XML to JSON is quite easy and can be done various ways: ing%29 toJSONObject%28java lang String%29 For converting from XML to JSON look at this maybe, seems to be very simple: xml2json xslt lib sourceforge net index html There is also library which allows you to make conversion in both sides (also to POJOs) .
  • Tools that can be used for converting from to XML JSON (e g , StaxON , lib sourceforge net JSON lib , Jettison , XStream ) do not seem to do that but only conversion of a known structure .
  • Since escaping new lines quotes etc can make this a little tricky, why not just use XStream to convert the object to XML and wrap the HTML in a CDATA section ?.
  • Since escaping new lines quotes etc can make this a little tricky, why not just use XStream]( ) to convert the object to XML and wrap the HTML in a CDATA section]( ) ?.
  • I want to be able to create a list of objects to send to the server and be properly marshalled into Java but the format that XStream and JSON expect it in is very non intuitive and requires our javascript libraries to jump through hoops .
Summaries of the opinions about xstream using Opinosis, an abstractive summarizer of opinions..
  • tutorial html .
  • good alternative ! .
  • object serialization .
  • good json .
  • escaping new lines quotes etc can make this a little tricky .
Summaries of the opinions about xstream using contrastive viewpoints. Each entry contains a pair of positive and negative sentences that are most likely discussing about similar API features.
    • However, when I have JSON string like the following CODESNIPPET JAVA1 .
    • For example this fails: CODESNIPPET JAVA1 .
    • I like XStream very much .
    • XStream seems somewhat less flexible, and it's fairly slow .
    • I would recommend XStream as it can parse either .
    • XStream seems somewhat less flexible, and it's fairly slow .
    • Take a look at XStream: It's a lightweight library for xml and json serialization .
    • XStream seems somewhat less flexible, and it's fairly slow .
    • Xstream 1 2 2 supports Java 1 4 .
    • XStream seems somewhat less flexible, and it's fairly slow .
    • XStream is renowned for its ease of use and supports JSON: .
    • XStream seems somewhat less flexible, and it's fairly slow .
    • XStream is good for JSON: .
    • XStream seems somewhat less flexible, and it's fairly slow .
    • For example, like this: CODESNIPPET JAVA1 .
    • For example this fails: CODESNIPPET JAVA1 .
    • I actually have since used XStream which seemed to work well .
    • XStream seems somewhat less flexible, and it's fairly slow .
    • Why are you using xstream for json support?.
    • XStream seems somewhat less flexible, and it's fairly slow .
Summaries of opinions about based on specific API aspects, such as, performance, usability, etc. The 'Overview' page provides an overview of the aspects detected in the opinions. The 'Trend' page shows the distribution of polarity over time for each aspect. The 'Positive Opinions' page groups positive opinions by the detected aspects. The 'Contrastive By Aspect' page shows paris of contrastive opinions under each aspect (where found).
Features:
  • Oops!
  • Thanks @atomman (+1) - Unofrtunately, this morning I realized that my JSON string at the top of my question was incorrect, so I edited it to reflect the actual (correct) JSON I'm dealing with.
Documentation:
  • To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient [reputation]( URL_http://stackoverflow.com/help/whats-reputation ) you will be able to [comment on any post]( URL_http://stackoverflow.com/help/privileges/comment) .
  • N/A
Community:
  • To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient [reputation]( URL_http://stackoverflow.com/help/whats-reputation ) you will be able to [comment on any post]( URL_http://stackoverflow.com/help/privileges/comment) .
  • N/A
Onlysentiment:
  • Thank you!
  • I am sorry!.
Performance:
  • Note however that XStream really is an XML-based object serializer; so while it does have JSON compatibility support, it goes through JSON->XML converter (Jettison) so any size or performance benefits JSON may have are lost.
  • XStream seems somewhat less flexible, and it's fairly slow.
Bug:
  • XStream worked good for me; also, it returned better error messages when e.g.
  • I tried to solve your problem using XStream all the ways I could think of and I have failed.
Usability:
  • @DeepakBala This seems a very good idea/alternative.
  • I tried to solve your problem using XStream all the ways I could think of and I have failed.
  • Features: 15
    1. list: 2
      • Luckily, the unnecessary list wrapper element is omitted in JSON: CODESNIPPET_JAVA2 .. details
      • I'm guessing CODETERM1 has a list of attributes, each pointing to their respective entity.. details
    2. json: 1
      • However, when I have JSON string like the following CODESNIPPET_JAVA1 .. details
    3. http: 1
      • The server will send back the correct type based on one of: the HTTP Accept header a "filetype extension", such as ".json" a querystring parameter, such as "format=json" .. details
    4. properties: 1
      • Properties p new Properties(); p.setProperty("a", "b"); p.setProperty("x", "y"); should be converted to: CODESNIPPET_JAVA1 .. details
    5. general: 10
      • Oops!. details
      • Correct answer to the wrong question - I'm just interested in XStream here, who's JettisonMappedXmlDriver is perfectly suited for JSON.. details
      • Xstream 1.2.2 supports Java 1.4.. details
      • Can you please suggest some solution?. details
      • (added) None of the answers were what I really wanted ("yes, in javax.obscure.interfaces there's what you want") but thanks for the replies.. details
      • I now have a requirement to round the value to a given number of decimal places.. details
      • These were serializing fine.. details
      • hey hi i didnt find in it can you give me link.. details
      • For example, like this: CODESNIPPET_JAVA1 .. details
      • How can I ask the XStream to disable the pretty printing?. details
  • Documentation: 4
    1. general: 4
      • To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient [reputation]( URL_http://stackoverflow.com/help/whats-reputation ) you will be able to [comment on any post]( URL_http://stackoverflow.com/help/privileges/comment) .. details
      • a quick look at the xstream converters tutorial shows this example: "@XStreamConverter(value=BooleanConverter.class, booleans={false}, strings={"yes", "no"})".. details
      • so... based on the example in your answer (and the tutorial), you are deserializing to a Product instead of a Map or something like that, which is exactly what I was referring to with the class hierarchy.. details
      • Check out this tutorial on URL_http://xstream.codehaus.org/json-tutorial.html [JSON-and- Java] As a good practice, check whether your JSON is valid.. details
  • Community: 1
    1. general: 1
      • To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient [reputation]( URL_http://stackoverflow.com/help/whats-reputation ) you will be able to [comment on any post]( URL_http://stackoverflow.com/help/privileges/comment) .. details
  • Onlysentiment: 16
    1. general: 16
      • @hd1 : Thanks for the response.. details
      • @DeepakBala This seems a very good idea/alternative.. details
      • This is a good alternative!.. details
      • Thank you!. details
      • I found a way to fix this question:xstream.addImplicitCollection(this.getClass(), "mails", MailDto.class);Thank you!.. details
      • I like XStream very much.. details
      • thanks.. details
      • thanks in advance!. details
      • Thanks in advance!. details
      • Thanks in advance!Regards, Michael .. details
      • Thanks .. details
      • Any help will be appreciated.. details
      • I feel like this should be easier than it seems.. details
      • Thanks for the hint to this library but I suppose I won't give it a try.. details
      • I would recommend URL_http://xstream.codehaus.org/ [XStream] as it can parse either.. details
      • Kind Regards .. details
  • Performance: 1
    1. general: 1
      • Note however that XStream really is an XML-based object serializer; so while it does have JSON compatibility support, it goes through JSON->XML converter (Jettison) so any size or performance benefits JSON may have are lost.. details
  • Bug: 2
    1. general: 2
      • XStream worked good for me; also, it returned better error messages when e.g.. details
      • I found a way to fix this question:xstream.addImplicitCollection(this.getClass(), "mails", MailDto.class);Thank you!.. details
  • Usability: 80
    1. mapper: 1
      • But I still need a way to configure a mapper to dynamically map such a CODETERM5 back to either a CODETERM6 or an CODETERM7 .. details
    2. stream: 1
      • I tried Xstream but found a variety of limitations with JsonHierarchicalStreamDriver and the JettisonMappedXmlDriver.1) The Stream driver cannot deserialize it can only serialize2) The mapped xml driver can do both but cannot produce pretty JSONIf one is ok with the above constraints, XSTREAM is a good choice.. details
    3. root: 2
      • According to URL_http://xstream.codehaus.org/json-tutorial.html#json-dropping- root ["Write-to-JSON-with-the-self-contained-JSON-driver-dropping-the-root "-in-the-JSON-tutorial] , you can write something like this: CODESNIPPET_JAVA1 .. details
      • most notably it doesn't have a root node, I'm not sure how to parse it.. details
    4. object: 3
      • See JavaDoc - toXML: Serialize an object to a pretty-printed XML String.. details
      • @ruack hey thanks buddy.But the object of Class A what i Have mentioned is not the root element.It is has a reference inside class C which supposed to be the root class.. details
      • So I would suggest just using XML, if going with XStream (which is a good tool for object serialization, that's what it's designed for).. details
    5. binding: 1
      • One popular JSON-to-Java binding library is URL_http://jackson.codehaus.org/ [Jackson] One popular XML-to-Java binding library is URL_http://xstream.codehaus.org/ [XStream] If you intend to use this in a web application, maybe you would like to consider URL_http://static.springsource.org/spring/docs/current/spring- framework-reference/html/mvc.html [Spring-3-MVC] 's facilities for this.. details
    6. gson: 2
      • This works fine in XStream but GSON seems to have issues (see above I edited my post).. details
      • I know its good to use gson or Xstream like things., but I need to do using Marshaller.How to achieve it?. details
    7. jettison: 1
      • [EDIT Update issues using URL_http://code.google.com/p/google-gson/ [GSON] library]I attempted to use the URL_http://code.google.com/p/google-gson/ [GSON-library] but it cannot deserialize concrete objects when I only have it expect generic super classes (XStream and Jettison handles this because type information is baked into the serialization).. details
    8. json: 25
      • Well, the only way I see that can reproduce that JSON is by using the JsonHierarchicalStreamDriver with the DROP_ROOT mode activated.. details
      • @BorisStrandjev The docs for xstream make it look like it's primarily an xml serialization library with json format input/output retrofitted.. details
      • I've been thinking for these two JSON library: Google Gson JSON.Simple XStream Google Gson is pretty awesome, it can serialize class object that have no-args constructor.. details
      • Check out this tutorial on URL_http://xstream.codehaus.org/json-tutorial.html [JSON-and- Java] As a good practice, check whether your JSON is valid.. details
      • Why are you using xstream for json support?. details
      • I'd like the above JSON string to map back to a CODETERM7 , but I can't seem to figure out how to alias the class correctly: CODESNIPPET_JAVA3 .. details
      • I'll be dealing with a JSON string that might look like this: CODESNIPPET_JAVA1 .. details
      • But it can be used for JSON as well, look here URL_http://xstream.codehaus.org /json-tutorial.html [XStream-JSON-Tutorial] More libraries can be found here URL_http://www.json.org/ [ URL_http://www.json.org/ ] EDIT For displaying in HTML you can use Javascript: URL_http://msdn.microsoft.com /en-us/library/ie/cc836459%28v=vs.94%29.aspx [JSON.stringify- Function-(JavaScript)] CODESNIPPET_JAVA1 .. details
      • And you are decoupled from one of the many many XML or JSON libraries, so clients are freer to pick their favorite.. details
      • Take a look at XStream: URL_http://xstream.codehaus.org/ [ URL_http://xstream.codehaus.org/ ] It's a lightweight library for xml and json serialization.. details
      • The thing is that XStream is first and foremost designed to marshal and unmarshal Java objects to XML, JSON being just an afterthought, it most certainly has the least elegant support.. details
      • Another converter is required, and this works well for the xml, but in json it renders the value as a string (i.e.. details
      • yes , XML to JSON is easy but i need XSD to JSON Schema.. details
      • I feel like converting a java hash to json hash should be straight forward.. details
      • XStream, for example, is good for XML, but produces ugly JSON (and slowly at that).Going from XML to JSON is error-prone due to format impedance and I have yet to see an XML-processing lib that produces JSON clean JSON efficiently (or even just clean or efficiently).. details
      • I would use URL_http://xstream.codehaus.org/ [Xstream] which supports XML and JSon with mapping of data structures.. details
      • You could use the Jettison driver with XStream to serialize / deserialize string <-> json : URL_http://xstream.codehaus.org/json-tutorial.html [ URL_http://xstream.codehaus.org/json-tutorial.html ] I had used this sometime back - there are some caveats on how the json schema should be for the parser to parse perfectly well.. details
      • By manually I meant not by using a JSON library like Simple JSON, Gson, or XStream.. details
      • I am currently deserializing JSON using XStream, and it has been working great.. details
      • URL_http://simple.sourceforge.net/ [Simple] apparently can deal with more complex object graphs, but XStream seems more popular, does JSON and will probably suit my needs (I won't be ever having cyclic references).. details
      • Note however that XStream really is an XML-based object serializer; so while it does have JSON compatibility support, it goes through JSON->XML converter (Jettison) so any size or performance benefits JSON may have are lost.. details
      • I agree with other poster in that XStream is not a good fit -- it's an OXM (Object/Xml Mapper), and JSON is handled as a secondary output format using XML processing path.. details
      • Does anyone have a suggestion for a good JSON Java object serialization that allows you to read/write arbitrary Java objects.. details
      • Intuitively I expect the XStream JSON to be serialized (and able to deserialize correctly) from the following format: CODESNIPPET_JAVA3 .. details
      • It now supports JSON ouput.. details
    9. result: 1
      • URL_http://xstream.codehaus.org/json-tutorial.html [xStream-has-some-JSON- support-built-in] , maybe you should try that and see what the result is.. details
    10. pretty-print: 2
      • pretty-Print Writer does not suffice my needs.. details
      • pretty-Print Writer does not suffice my needs.. details
    11. jaxb: 3
      • MOXy does look like a very promising candidate in XML space -- giving JAXB RI and XStream run for their money.. details
      • Actually, any XML package that can use Stax API can use Jettison -- JAXB does, so there's no extra work involved (same is mostly true for XStream too, although it may have some additional support).. details
      • For POJO to XML I suggest using URL_http://www.oracle.com/technetwork/articles/javase/index-140168.html [JAXB] (there are other libraries as well, such as XStream for example, but JAXB is standardized).. details
    12. interface: 1
      • Such an interface would be fairly simple to implement in GSON, XStream etc.. details
    13. output: 1
      • Using XStream and JsonHierarchicalStreamDriver to output values, how do I round doubles?. details
    14. serialization: 1
      • Xstream supports serialization to JSON: URL_http://xstream.codehaus.org/json - tutorial.html.. details
    15. general: 33
      • @DeepakBala This seems a very good idea/alternative.. details
      • I like XStream very much.. details
      • XStream worked good for me; also, it returned better error messages when e.g.. details
      • I tried Xstream as well but I was not able to .Btw the name of the xml tag will change Dynamically .. details
      • This is a good alternative!.. details
      • Use a third party library like XStream.. details
      • By adding CODETERM7 to your enum, you now have a way to look up all the various enumerated values from the outside, by providing a CODETERM8 string.. details
      • Configure XStream to dynamically map to different objects.. details
      • The only thing I can think of is first doing a String-replace like so: CODESNIPPET_JAVA7 .. details
      • You can also use xStream for doing it which has got a very simple API.. details
      • Sample xml would be helpful for sure.. details
      • I'm using XStream 1.4.2, intialized like that: CODESNIPPET_JAVA3 .. details
      • The objects are very simple: CODESNIPPET_JAVA1 .. details
      • URL_http://stackoverflow.com/questions/6505532/formatting-decimal-values-for- xml [Formatting-decimal-values-for-XML] I am serializing objects to both xml and json.. details
      • This library can help you do that: URL_http://xstream.codehaus.org/javadoc/com/thoughtworks/xstream/io/json/JsonH ierarchicalStreamDriver.html [ URL_http://xstream.codehaus.org/javadoc/com/thoughtw orks/xstream/io/json/JsonHierarchicalStreamDriver.html] Create yourself a reader using one of the factory methods: URL_http://xstream.codehaus.org/javadoc/com/thoughtworks/xstream/io/Hierarchic alStreamReader.html [ URL_http://xstream.codehaus.org/javadoc/com/thoughtworks/xstr eam/io/HierarchicalStreamReader.html] And then use the moveDown/moveUp methods to find the spot(s) of interest, and fish out your values.. details
      • I feel like this should be easier than it seems.. details
      • Thanks for the hint to this library but I suppose I won't give it a try.. details
      • I like URL_http://jackson.codehaus.org/ [Jackson] for JSON, and URL_http://xstream.codehaus.org/ [XStream] for XML.. details
      • Update: @radai suggests the Simple XML library, which looks pretty interesting.. details
      • I would recommend URL_http://xstream.codehaus.org/ [XStream] as it can parse either.. details
      • If you need to be able to manipulate your XML before it gets converted to JSON, or want fine-grained control of your representation, go with XStream.. details
      • It's like trying to escape URLs manually, instead of using URLEncode/Decode.... details
      • XStream is good for JSON: URL_http://xstream.codehaus.org/json-tutorial.html [ URL_http://xstream.codehaus.org/json-tutorial.html ] .. details
      • I actually have since used XStream which seemed to work well.. details
      • The XStream library also supports JSON: URL_http://xstream.codehaus.org/json- tutorial.html [ URL_http://xstream.codehaus.org/json-tutorial.html ] .. details
      • I personally like URL_http://xstream.codehaus.org/json-tutorial.html [XStream] but there are many various implementations available.. details
      • It looks like a conversation has been going about this, and it makes sense.. details
      • How to disable pretty-printing(white space/newline) in XStream?. details
      • Both of them are pretty-printing (indenting) the output.. details
      • XStream is renowned for its ease of use and supports JSON: URL_http://xstream.codehaus.org/json-tutorial.html [ URL_http://xstream.codehaus.org/json-tutorial.html ] .. details
      • Apparently the CompactWriter works only for XML.. details
      • To me, URL_http://xstream.codehaus.org/json-tutorial.html [the-best-Java -<->-JSON-parser-is-XStream] (yes, I'm really talking about json, not about xml).. details
      • XStream already deals with circular dependencies and has a simple and powerful api where you could write yours drivers, converters and so on.. details
    16. data: 1
      • ... Or use xstream and don't mess with mirroring the data structure.... details
    17. class: 1
      • so... based on the example in your answer (and the tutorial), you are deserializing to a Product instead of a Map or something like that, which is exactly what I was referring to with the class hierarchy.. details
  • Onlysentiment: 2
    1. general: 2
  • Performance: 2
    1. general: 2
      • XStream seems somewhat less flexible, and it's fairly slow.. details
      • parsing xml is more expensive than JSON in this case.. details
  • Features: 9
    1. general: 9
      • Thanks @atomman (+1) - Unofrtunately, this morning I realized that my JSON string at the top of my question was incorrect, so I edited it to reflect the actual (correct) JSON I'm dealing with.. details
      • Here a code sample found on XStream implementation website ( URL_http://xstream.codehaus.org/json-tutorial.html [Xstream-website] ): CODESNIPPET_JAVA1 .. details
      • May be you can choose another lib, refer to URL_http://json - lib.sourceforge.net/apidocs/jdk15/net/sf/json/JSONObject.html.. details
      • Unfortunately, I cannot change the fact that this 3rd party REST service always sends back a CODETERM4 JSON result.. details
      • What's wrong with my example?. details
      • XStream: Omit collection with XStreamImplicit.. details
      • POJO (DTO): CODESNIPPET_JAVA2 .. details
      • A small price to pay (ugly json) for true serialization.. details
      • For example this fails: CODESNIPPET_JAVA1 .. details
  • Bug: 6
    1. general: 6
      • I tried to solve your problem using XStream all the ways I could think of and I have failed.. details
      • Unfortunately when I run this I get an exception, because I have CODETERM9 mapping CODETERM10 to 2 different Java objects: CODESNIPPET_JAVA6 .. details
      • The technical problem being that as XStream must support both - XML and JSON formats, JSON map representation suffers, as there is no native way to represent a map-like structures in XML.. details
      • Using it I get the following json: {"simpleperson": { "name": "joe", "cars": ["Jag", "BMW"] }} When I use the same json to convert it back to an object using xstream.fromXML(json), I get the following exception: Exception in thread "main" com.thoughtworks.xstream.converters.reflection.Ab stractReflectionConverter$DuplicateFieldException: Duplicate field cars I cant figure out what is the problem.. details
      • I have a problem with XStream.. details
      • Yes, this is a big problem, and is rather hard to solve.. details
  • Usability: 26
    1. converter: 1
      • Tried XStream, but its giving me unwanted Element nodes which is not required in my xml.The converter in Json.org was close, but it creates only Text/node based XML and NOT creating attribute based.. details
    2. format: 1
      • In the below format my doubt is the type mentioned with every field.. details
    3. object: 1
      • Since escaping new lines / quotes etc can make this a little tricky, why not just use [XStream]( URL_http://xstream.codehaus.org /) to convert the object to XML and wrap the [HTML in a CDATA section]( URL_http://www.w3schools.com/xml/xml_cdata.asp ) ?. details
    4. list: 1
      • As of this writing, there are these 20: URL_http://www.JSON.org/java/index.html [org.json] URL_https://github.com/upictec/org.json.me/ [org.json.me] URL_http://jackson.codehaus.org/ [Jackson-JSON-Processor] URL_http://json-lib.sourceforge.net/ [Json-lib] URL_http://developer.berlios.de/projects/jsontools/ [JSON-Tools] URL_http://code.google.com/p/json-simple/ [json-simple] URL_http://www.stringtree.org/stringtree-json.html [Stringtree] URL_http://sojo.sourceforge.net/ [SOJO] URL_http://www.restlet.org/ [Restlet] URL_http://jettison.codehaus.org/ [Jettison] URL_http://json-taglib.sourceforge.net/ [json-taglib] URL_http://xstream.codehaus.org/ [XStream] URL_http://code.google.com/p/jsonmarshaller/ [JsonMarshaller] URL_http://flexjson.sourceforge.net/ [Flexjson] URL_http://sourceforge.net/projects/jontools/ [JON-tools] URL_http://code.google.com/p/google-gson/ [google-gson] URL_http://argo.sourceforge.net/ [Argo] URL_http://pivot.apache.org/ [Pivot] URL_http://jwm.slavitica.net/p/projects/jsonij [jsonij] URL_http://sourceforge.net/projects/fastjson/ [fastjson] ...but of course the list can change.. details
    5. general: 8
      • XStream seems somewhat less flexible, and it's fairly slow.. details
      • I tried to solve your problem using XStream all the ways I could think of and I have failed.. details
      • Can xstream deserialize a complicated array?. details
      • But this seems like an ugly hack.. details
      • Tools that can be used for converting from/to XML/JSON (e.g., URL_http://beckchr.github.com/staxon/ [StaxON] , URL_http://json- lib.sourceforge.net/ [JSON-lib] , URL_http://jettison.codehaus.org [Jettison] , URL_http://xstream.codehaus.org/ [XStream] ) do not seem to do that but only conversion of a known structure.. details
      • URL_http://xstream.codehaus.org/ [XStream] has a URL_http://xstream.codehaus.org/javadoc/com/thoughtworks/xstream/io/json /package-summary.html [JSON-serializer-and-deserializer] for arbitrary Java objects.. details
      • The trouble may be caused by it using the XStream XML URL_http://xstream.codehaus.org/converters.html [CollectionConverter] ?. details
      • Yes, this is a big problem, and is rather hard to solve.. details
    6. json: 9
      • The technical problem being that as XStream must support both - XML and JSON formats, JSON map representation suffers, as there is no native way to represent a map-like structures in XML.. details
      • And XML to JSON is not very valuable either, because it tends to produce "franken-JSON" which contains unnecessary non-JSON stuff (to retain XML namespace info, attribute/element distinction etc).. details
      • Using it I get the following json: {"simpleperson": { "name": "joe", "cars": ["Jag", "BMW"] }} When I use the same json to convert it back to an object using xstream.fromXML(json), I get the following exception: Exception in thread "main" com.thoughtworks.xstream.converters.reflection.Ab stractReflectionConverter$DuplicateFieldException: Duplicate field cars I cant figure out what is the problem.. details
      • Converting XML to JSON is quite easy and can be done various ways: URL_http://answers.oreilly.com/topic/278-how-to-convert-xml-to-json-in-java [ URL_http://answers.oreilly.com/topic/278-how-to-convert-xml-to-json-in-java ] URL_http://www.json.org/javadoc/org/json/XML.html#toJSONObject%28java.lang.Str ing%29 [ URL_http://www.json.org/javadoc/org/json/XML.html toJSONObject%28java.lang .String%29] For converting from XML to JSON look at this maybe, seems to be very simple: URL_http://www.bramstein.com/projects/xsltjson/ [ URL_http://www.bramstein.com/projects/xsltjson/ ] URL_http://code.google.com/p/xml2json-xslt/ [ URL_http://code.google.com/p /xml2json-xslt/] URL_http://json-lib.sourceforge.net/index.html [ URL_http://json - lib.sourceforge.net/index.html] There is also URL_http://xstream.codehaus.org/ [ URL_http://xstream.codehaus.org/ ] library which allows you to make conversion in both sides (also to POJOs).. details
      • I've looked into XStream, Eclipse MOXy, FlexJSON, JSON-lib & gson My goal is to get rid of my json wrapper classes and minimize code.. details
      • It is not easy with XStream, because XStream first marshals the CODETERM1 object into intermediary XML before converting the XML to JSON and getting the XML just right is hard.. details
      • parsing xml is more expensive than JSON in this case.. details
      • FWIW, XStream with Badgerfish (jettison) does handle them (since it's full object-serialization framework, although resulting json looks ugly, as its xml based, just converts to json via badgerfish).. details
      • I want to be able to create a list of objects to send to the server and be properly marshalled into Java but the format that XStream and JSON expect it in is very non-intuitive and requires our javascript libraries to jump through hoops.. details
    7. html: 1
      • Since escaping new lines / quotes etc can make this a little tricky, why not just use URL_http://xstream.codehaus.org/ [XStream] to convert the object to XML and wrap the HTML in a CDATA section ?. details
    8. result: 1
      • you should use XStream annotation to omit the required field from result .. details
    9. element: 1
      • But unfortunately, only the last element is printed**.. details
    10. annotations: 1
      • I have not found an easy generic solution using annotations or built in functionality in the above libraries but I have probably overlooked them.. details
    11. jersey: 1
      • Works nicely with Jersey, and I am use it myself (current Jersey version does not bundle full Pojo data binding by default, but will in near future) I would actually not use any of xml libs to produce "json": XStream and JAXB/Jettison can produce kind of JSON, but it uses ugly conventions that are rather non-intuitive.. details