1

I have one big json resulting file, something like this:

{'status': 200, 'result': [{'query': 'AL1 2RJ', 'result': {'postcode': 'AL1 2RJ', 'quality': 1, 'eastings': 514617, 'northings': 206084, 'country': 'England', 'nhs_ha': 'East of England', 'longitude': -0.341337, 'latitude': 51.741753, 'european_electoral_region': 'Eastern', 'prim ...

It goes on and on, what I need, is to have this somehow as a tree.

I've tried with underscore-cli

Then with this command: cat myfile.json | underscore print --color

It Throws me this: Error while parsing STDIN in mode 'lax': None is not defined

Any ideas on how to achieve this?

Gilad Bar
  • 1,302
  • 8
  • 17
Alberto
  • 43
  • 4

1 Answers1

2

On python you can select the indentation on json.dumps like this:

import json
print(json.dumps(t,indent=4))

that results in:

{
    "status": 200,
    "result": [
        {
            "query": "AL1 2RJ",
            "result": {
                "postcode": "AL1 2RJ",
                "quality": 1,
                "eastings": 514617,
                "northings": 206084,
                "country": "England",
                "nhs_ha": "East of England",
                "longitude": -0.341337,
                "latitude": 51.741753,
                "european_electoral_region": "Eastern"
            }
        }
    ]
}
Pedro Borges
  • 1,240
  • 10
  • 20