Numbers cannot have leading zeros in JSON

If you write this dataset:

image

To a JSON file and let Easy Data Transform set the “Code” column type automatically, you get:

[
  {
    "code": 001
  },
  {
    "code": 002
  },
  {
    "code": 003
  }
]

Which looks fine. But Easy Data Transform can’t then read it back in as an input.

The reason is that the JSON parser we use doesn’t treat anything starting with a ‘0’ as a number. The reason for this obscure decision is discussed here:

So it should have output “Code” as JSON strings by default:

[
  {
    "code": "001"
  },
  {
    "code": "002"
  },
  {
    "code": "003"
  }
]

You can work around this issue by manually set the “Code” column type to JSON string:

We should be able to fix this so that numbers with leading 0s are output as JSON strings by default.

Thanks to Michael S. for bringing this to our attention.

Thank you for helping to resolve this question so quickly. This is a great tool which really simplifies data management!!

1 Like

This fix is done and will be in the next release.

BTW none of the following are considered valid numbers in a JSON file:

1,234
01
00.0