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.
精彩评论