adamritter / fastgron

High-performance JSON to GRON (greppable, flattened JSON) converter
MIT License
592 stars 10 forks source link

fastgron 0.6.4 fails to understand its own output for integer keys #17

Closed brandenburg closed 9 months ago

brandenburg commented 11 months ago

When piping the output of fastgron to fastgron -u, I would expect to again obtain the input file. That does not happen if the input file contains integer keys.

Example:

$ cat /tmp/example.json 
{
  "foo": {
    "123": "xxx"
  }
}

$ fastgron /tmp/example.json 
json = {}
json.foo = {}
json.foo["123"] = "xxx"

$ fastgron /tmp/example.json | fastgron -u
{
  "foo": {

  }
}

The value for key "123" is unexpectedly absent.

$ fastgron --version
fastgron version 0.6.4

Plain old gron handles this as I would expect:

$ fastgron --semicolon  /tmp/example.json | gron -u
{
  "foo": {
    "123": "xxx"
  }
}
adamritter commented 9 months ago

Thanks for the error report, I added basic string key support and released v0.6.5, although parsing escaping (\ and ") is still missing.