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
asked Jan 27, 2012 at 10:46
Vivek
2,11111 gold badges46 silver badges62 bronze badges
1 Answer 1
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);
answered Jan 27, 2012 at 10:49
MrKiane
5,0332 gold badges19 silver badges27 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
lang-java