开发者

Return a JSONArray as an HTTP Entity

Summary: I want to return a JSONArray via an HTTP response. How do I do that?

I am working on a problem where I was previously returning a JSON object, which was being converted to JSONEntity and then a HTTPEntity using a utility that I have. Now I need to return an JSONArray, but I don't know how to have my REST service return the array. If someone could help me I would really appreciate it.

Thanks!

A little background: I was previously using a DOJO ItemWriteStore to build a tree. Now I am switching to a JSONRestStore to enable my tree to have lazy loading. The problem came up because most stores in Dojo take JSONObjects, but the JSONRestStore, which supports lazy loading, needs a JSONArray.

Aslo, 开发者_Go百科I am using the org.apache.http package for my HTTP repsonse


You could use the json-simple library to encode it into a JSONArray object.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜