/flatten-json

What if you want to store complex JSON in a simple Key:Value format

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

flatten-json

The goal if this tiny script is to take an arbitrary JSON and flatten it into a one level dict.

For instance:

    {
        "x.y": [
            {
                "x.1": 1,
                "n": {
                    "a":1,
                    "b":2,
                },
            },
            {
                "k":"l",
            },
        ],
        "b":"c",
        "0":1,
    }

will be converted to:

  {
      "b": "c",
      "0": "1",
      "x\\\\.y.0.n.a": "1",
      "x\\\\.y.0.n.b": "2",
      "x\\\\.y.1.k": "l",
      "x\\\\.y.0.x\\\\.1": "1",
  }