1

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, I am using the org.apache.http package for my HTTP repsonse

2

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.