I am trying to get an array of objects from the server, using JSON.
The server sends me the following string.
\"[{\\\"DealComment\\\":null,\\\"DealVo
It looks like your incoming string is doubly JSON encoded. You should decode it, then decode that again.
Here's my best guess as to how you might do that in Java:
JSONArray resultArray = new JSONArray(new JSONString(jsonFormattedString));
I'm assuming here that JSONString is a type. Your actual solution may vary.
Under normal circumstances, I'd expect a service to give you JSON straight up. It appears that this services is giving you a string (encoded according to the JSON spec) which contains JSON.
It's the difference between the following:
String someJSON = "[0, 1, 2]";
String doublyEncodedJSON = "\"[0, 1, 2]\"";
Notice the extra leading and trailing quotes? That's because the latter is a string of JSON. You'd have to decode it twice to get the actual object.