#71·gron

ungron doesn't reproduce streamed JSON

Author: joeshawCreated Apr 27, 2020Updated Nov 13, 2023

Consider a multi-line "stream" JSON file:

{"one": 1}
{"two": 2}
{"three": 3}

Running gron -s on this file produces:

json = [];
json[0] = {};
json[0].one = 1;
json[1] = {};
json[1].two = 2;
json[2] = {};
json[2].three = 3;

Running gron -u and gron -u -s on that output produces:

[
  {
    "one": 1
  },
  {
    "two": 2
  },
  {
    "three": 3
  }
]

Note that this was transformed into a JSON list. That makes sense with gron -u but it would be nice if gron -u -s understood this and produced a file that was semantically equivalent to the first one.