Skip to content

Latest commit

 

History

History
35 lines (28 loc) · 831 Bytes

README.rst

File metadata and controls

35 lines (28 loc) · 831 Bytes

json2txttree

Python code that converts JSON data to tree-like output for documentation or pretty printing

Usage

import json
from json2txttree import json2txttree

# Load json data
with open('sample.json', 'r') as f:
  jsonData = json.load(f)

# Pretty print json hierarchy as a tree
print(json2txttree(jsonData))

└─  (object)
   ├─ "name" (string)
   ├─ "age" (number)
   ├─ "languages" (array)
   │  └─  (string)
   ├─ "subjects" (object)
   │  ├─ "Math" (number)
   │  └─ "Science" (number)
   └─ "ids" (array)
      └─  (object)
         ├─ "name" (string)
         └─ "number" (string)

Installation

Use pip to install this package.