java - Is a JSON array absolutely necessary for a list of JSON objects stored as carriage-delimited lines? -
suppose have extremely big info set, each info item serialized json object. when place these file, have 2 choices.
(1) can write them out 1 json object per line, delimited carriage returns / newlines:
{ jsonobject } { jsonobject } ...
(2) however, official spec says above formatting isn't legal. have utilize json array:
[ { jsonobject }, { jsonobject } ]
i think first approach easier parse in code because can read in 1 text line @ time (i'm using java , utilize bufferedreader.readline()), , parse line json object.
the sec approach may run out of memory depending on parser you're using, right? parser may need read whole file memory build array.
what best practice problem?
java json
No comments:
Post a Comment