Does anyone else have this problem importing prettified json/graphson to JanusGraph?
Exactly the same file but not prettified (no carriage returns, tabs, whitespace) will import perfectly but if prettified it fails with the following error:
graph.io(graphson()).readGraph("data/tgraph2.json")
Could not deserialize the JSON value as required. Nested exception: java.lang.InstantiationException: Cannot deserialize the value with the detected type contained in the JSON ('tinker:graph') to the type specified in parameter to the object mapper (class java.util.LinkedHashMap). Those types are incompatible. at [Source: (ByteArrayInputStream); line: 1, column: 3]
Note, editing the file to remove the first line break manually and the error message changes to ... at [Source: (ByteArrayInputStream); line: 1, column: 12]
etc - so it is definitely an issue with whitespace in the file.
Version 3.x
Surely this is not desired behaviour. json should work the same whether prettified with whitespace or minified.
Something to be aware of is that there are two forms of GraphSON. In one form, the entire file is not a single JSON document, instead each line is. Each line represents the adjacency list for a vertex.
That is the default GraphSON format and it is designed that way for streaming and so that the file can easily be broken up for multi-threaded operations. The other form is a single JSON document that contains all the vertices and then all the edges.
The formats are documented here