1

How can I decode this JSON String which has been received as a parameter via the ajax call. This String is basically a Javascript Array which has been passed using JSON.stringify.

The format received at my Java End is something like this.

%5B%22Name%22%2C%22Vivek%22%2C%

how can i decode this String so that I can create a JSONArray from it using

JSONArray.fromObject

because passing the above mentioned format throws an error

1 Answer 1

6

It looks like it is URL encoded. Try decoding it before parsing.

String decodedString = java.net.URLDecoder.decode("%5B%22Name%22%2C%22Vivek%22%2C%", "UTF-8");
JSONArray json = new JSONArray(decodedString);
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.