I am starting with the json:
{
"Key1" : "Value1",
"Key2" : "Value2"
}
I am then hard-coding this json in a string:
String json = "{ \"Key1\" : \"Value1\", \"Key2\" : \"Value2\" }";
Next I attempt to parse the json:
JSONObject content = null;
try {
content = new JSONObject(json);
} catch (JSONException e) {
e.printStackTrace();
return null;
}
String key1 = content.optString("Key1", null);
If I look at the hashmap created from the call to JSONObject, it looks correct:
{Key2=Value2, Key1=Value1}
But when I look at the value of the string key1 in the debugger, I get this:
[V, a, l, u, e, 1, U, U, U, U, U, U, U, U, U, U]
Where U appears to be unicode character 25A1 (White Square).
I've also tried the generic get("Key1") method, casting the result to a string and I get the same behavior?!?

"Value1".equals(key1);