I am creating an instance of Gson
and writing with the following:
Gson gson = new GsonBuilder().setPrettyPrinting().create();
Writer writer = new FileWriter(location);
gson.toJson(data, writer);
This does write to the file, but the JSON object is incomplete and ends at line 7197 like this:
...
{
"type": "RockCell"
},
{
"type": "Flo
I have tried deleting and rerunning the code and it always stops writing at line 7197 in this exact way.
If I change the value of data
, it ends at a different point (line 7182) but again does so consistently.
In both cases, the files are 106,496 bytes in size. This issue still occurs if pretty printing is disabled, but the files are always 49,152 bytes.