-
-
Notifications
You must be signed in to change notification settings - Fork 74
Open
Description
This occurs when the string is nested and more than one level deep, e.g it occurs for
{"a": {"b": "[c-d]"}} but not {"b": "[c-d]"}
I'd expect the string "{"a": {"b": "[c-d]"}}" to be deserialized to:
{
"a" : {
"b" : "[c-d]"
}
}
It's actually deserialized to:
{
"a" : {
"b" : ["c-d"]
}
}
Here's a test for this that currently fails:
public void testElement_Object_nested() {
JSONObject jsonObject1 = new JSONObject();
jsonObject1.element( "str", "\"[]\"" );
Assertions.assertTrue(jsonObject1.get( "str" ) instanceof String); // This assertion passes
JSONObject jsonObject2 = new JSONObject();
jsonObject2.element( "obj", jsonObject1);
Assertions.assertTrue(jsonObject2.getJSONObject( "obj" ).get( "str" ) instanceof String); // This assertion fails
}I'm running version 2.4.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels