Skip to content

jayrahdevore/tldrj

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tldrj | The friendly json drilldown

Actions Status Code style: black

tldrj is a script that takes an arbitrary json file and boils it down to a bite-sized excerpt. It can also be used to infer datatypes, so you no longer need to look around a large file to see how it's structured. This is useful when creating relational database schema to store json-structured data, or when trying to view how a file is structured when writnig a script to parse it.


What it does

Say we have a neighborhood address book:

{
  "neighbors": [
    {
      "name": "Eddie Haskell",
      "address": "211 Pine Street",
      "num_cars": 0,
      "dependents": []
    },
    {
      "name": "Ward Cleaver",
      "address": "485 Maple Drive",
      "num_cars": 2,
      "dependents": [
        "June Cleaver",
        "Theodore Cleaver",
        "Wallace Cleaver"
      ]
    },
    {
      "name": "Clarence Rutherford",
      "address": "312 Rosewood Way",
      "num_cars": 1,
      "dependents": []
    }
  ],
  "neighborhood": "Happy Oaks",
  "city": "Mayfield"
}

tldrj can take this file and boil it down to a minimum working example

$ python3 tldrj.py -m example.json
{
    "neighbors": [
        {
            "name": "Ward Cleaver",
            "address": "485 Maple Drive",
            "num_cars": 2,
            "dependents": [
                "June Cleaver"
            ]
        }
    ],
    "neighborhood": "Happy Oaks",
    "city": "Mayfield"
}

tldrj can also take this file and infer a key and datatype schema

$ python3 tldrj.py -t example.json
{
    "neighbors": [
        {
            "name": "str",
            "address": "str",
            "num_cars": "int",
            "dependents": [
                "str"
            ]
        }
    ],
    "neighborhood": "str",
    "city": "str"
}

About

The friendly json drildown

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages