This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Web Services and the fly likes [jersey/jax-rs] json object value string has extra quotes, jsonp, service chaining‏ Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "[jersey/jax-rs] json object value string has extra quotes, jsonp, service chaining‏" Watch "[jersey/jax-rs] json object value string has extra quotes, jsonp, service chaining‏" New topic
Author

[jersey/jax-rs] json object value string has extra quotes, jsonp, service chaining‏

Stuart Swearengen
Greenhorn

Joined: Nov 02, 2006
Posts: 26
My short question is why does my jsonp response have an extra set of quotes around the json object, my second is how do I fix it. I'm so close to it all working.

I am returning a jsonp response from two different approaches. The first is by using jaxb annotation objects, this works well. (see callback1)
The second is by wrapping/chaining another external rest service into a string and returning the reponse as below using Client, this doesn't work (callback2). I think my problem is in the string and the jaxb object queryResult's String result property.
Stuart Swearengen
Greenhorn

Joined: Nov 02, 2006
Posts: 26
[SUM]

String s = "{\"ABCD\" : 123}";
JSONObject o = new JSONObject();
o.put("result", new JSONObject(s));
return new JSONWithPadding(o, callback);

works as I needed.
full answer is available on jersey.dev.java.net if you want to know more
 
 
subject: [jersey/jax-rs] json object value string has extra quotes, jsonp, service chaining‏
 
Similar Threads
Mapping a method data of a custom class to an Enum
Problem in converting ANSI to UTF-8
Transfering 3rd party (unserialized) objects through web server.
AJAX response to a Restful Jersey Resource
transfer unserilaized objects as SOAP response