VPackParser fails on valid json
kpiszczek opened this issue · 3 comments
kpiszczek commented
When trying to parse json containing array with multiple objects with null values parser fails with exception.
String json = "{\"values\": [ {\"a\": null}, {\"b\": null}]}";
VPackParser parser = new VPackParser.Builder().build();
parser.fromJson(json);
Results in:
Unexpected exception at position -1: null
at com.arangodb.velocypack.VPackParser$VPackContentHandler.add(VPackParser.java:386)
at com.arangodb.velocypack.VPackParser$VPackContentHandler.startObject(VPackParser.java:444)
at org.json.simple.parser.JSONParser.parse(JSONParser.java:488)
at org.json.simple.parser.JSONParser.parse(JSONParser.java:301)
at org.json.simple.parser.JSONParser.parse(JSONParser.java:295)
at com.arangodb.velocypack.VPackParser.fromJson(VPackParser.java:339)
at com.arangodb.velocypack.VPackParser.fromJson(VPackParser.java:331)
I'm using java-velocypack version 1.0.9
mvollmary commented
@kpiszczek thanks for reporting.
mvollmary commented
I already fixed it and deployed a new snapshot (1.0.10-SNAPSHOT).
Note: fromJson(json) will not include any null values. If you want them included in your vpack you have to use fromJson(json, true)
mvollmary commented
released version 1.0.10 today. It will be included in arangodb-java-driver version 4.2.2 which I will release today too.