You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.
When attempting to serialize a JSONObject with a null value the following exception is thrown:
java.util.NoSuchElementException: JSONObject["xxxx"] not found.
at org.json.JSONObject.get(JSONObject.java:220)
at com.fasterxml.jackson.datatype.jsonorg.JSONObjectSerializer.serializeContents(JSONObjectSerializer.java:57)
at com.fasterxml.jackson.datatype.jsonorg.JSONObjectSerializer.serialize(JSONObjectSerializer.java:28)
at com.fasterxml.jackson.datatype.jsonorg.JSONObjectSerializer.serialize(JSONObjectSerializer.java:14)
It seems like the following code in JSONObjectSerializer
try {
ob = value.get(key);
} catch (JSONException e) {
throw new JsonGenerationException(e);
}
if (ob == null || ob == JSONObject.NULL) {
if (provider.isEnabled(SerializationConfig.Feature.WRITE_NULL_MAP_VALUES)) {
jgen.writeNullField(key);
}
continue;
}
should instead be:
try {
ob = value.opt(key);
} catch (JSONException e) {
throw new JsonGenerationException(e);
}
if (ob == null || ob == JSONObject.NULL) {
if (provider.isEnabled(SerializationConfig.Feature.WRITE_NULL_MAP_VALUES)) {
jgen.writeNullField(key);
}
continue;
}
The text was updated successfully, but these errors were encountered:
When attempting to serialize a JSONObject with a null value the following exception is thrown:
java.util.NoSuchElementException: JSONObject["xxxx"] not found.
at org.json.JSONObject.get(JSONObject.java:220)
at com.fasterxml.jackson.datatype.jsonorg.JSONObjectSerializer.serializeContents(JSONObjectSerializer.java:57)
at com.fasterxml.jackson.datatype.jsonorg.JSONObjectSerializer.serialize(JSONObjectSerializer.java:28)
at com.fasterxml.jackson.datatype.jsonorg.JSONObjectSerializer.serialize(JSONObjectSerializer.java:14)
It seems like the following code in JSONObjectSerializer
should instead be:
The text was updated successfully, but these errors were encountered: