Browse Source

Null-node instead of removing attribute when set null as value

pull/212/head
Jan Lolling 9 years ago
parent
commit
3d0c3e99a5
  1. 2
      json-path/src/main/java/com/jayway/jsonpath/spi/json/JacksonJsonNodeJsonProvider.java

2
json-path/src/main/java/com/jayway/jsonpath/spi/json/JacksonJsonNodeJsonProvider.java

@ -268,7 +268,7 @@ public class JacksonJsonNodeJsonProvider extends AbstractJsonProvider {
} else if (value instanceof byte[]) { } else if (value instanceof byte[]) {
objectNode.put(key.toString(), (byte[]) value); objectNode.put(key.toString(), (byte[]) value);
} else if (value == null) { } else if (value == null) {
objectNode.remove(key.toString()); objectNode.set(key.toString(), null); // this will create a null-node
} else { } else {
throw new IllegalArgumentException("Cannot handle object type: " + value.getClass().getName()); throw new IllegalArgumentException("Cannot handle object type: " + value.getClass().getName());
} }

Loading…
Cancel
Save