json-tree-text-generator
TypeScript icon, indicating that this package has built-in type declarations

0.1.3 • Public • Published

JSON Tree Text Generator

A Node.js library that provides a function to generate text-based tree representations of JSON objects.

Installation

npm install json-tree-text-generator

Usage

const jsonTreeTextGenerator = require('json-tree-text-generator');

const sample = {
    Assets: {
        thirdParty: {
            CompanyName: {
                PackageName: {
                    Version: null,
                    PackageName: null
                }
            }
        },
        Art: {
            Animation: {
                AnimationClips: null,
                Animators: null
            },
            Audio: {
                AudioClips: null,
                AudioMixers: null
            }
        },
        Documentation: null,
        Settings: null
    }
};

const treeText = jsonTreeTextGenerator.generateTreeText(sample);

console.log(treeText);

Output:

└── Assets
    ├── thirdParty
    │   └── CompanyName
    │       └── PackageName
    │           ├── Version
    │           └── PackageName
    ├── Art
    │   ├── Animation
    │   │   ├── AnimationClips
    │   │   └── Animators
    │   └── Audio
    │       ├── AudioClips
    │       └── AudioMixers
    ├── Documentation
    └── Settings

Features

  • Supports nested JSON objects
  • Configurable indentation
  • Configurable output format

Readme

Keywords

none

Package Sidebar

Install

npm i json-tree-text-generator

Weekly Downloads

0

Version

0.1.3

License

ISC

Unpacked Size

4.89 kB

Total Files

6

Last publish

Collaborators

  • honsemiro