SHORT_META_KEYS issue
opened this issue · comments
SHORT_META_KEYS should stretch @Items to @e ; but sometimes @Items is replaced by @i leading to jsonToJava Exception.
Test code :
String testArray[] = new String[1];
testArray[0] = "Test";
String testOut = JsonWriter.objectToJson(
testArray,
new HashMap<String, Object>() {{
put(JsonWriter.SHORT_META_KEYS, TRUE);
}}
);
System.out.println(testOut);
// testOut = testOut.replaceAll("@i", "@e");
System.out.println(testOut);
Object object = JsonReader.jsonToJava(testOut);
Suspected source issue : JsonWriter line 1263
output.write(shortMetaKeys ? "\"@i\":[" : "\"@items\":[");
may be replaced with
output.write(shortMetaKeys ? "\"@e\":[" : "\"@items\":[");
Json-io is a great tool, thanks for your work and glad to participate.
Thank you for the nice unit test and clear instructions as to where the error was. I have fixed it and added your test to the library. A new release should be out within a day or two.