Attributes
Includes Deno configuration
Repository
Current version released
3 years ago
jsontree
jsontree converts a JS object into a nice, visible depth-indented tree for
console printing. The structure generated is similar to what you get by running
the tree command on Unixy platforms.
{
oranges: {
'mandarin': { ββ oranges
clementine: null, β ββ mandarin
tangerine: 'so cheap and juicy!' -=> β ββ clementine
} β ββ tangerine: so cheap and juicy!
}, ββ apples
apples: { ββ gala
'gala': null, ββ pink lady
'pink lady': null
}
}It also works well with larger nested hierarchies such as file system directory trees.
Quick start
Programmatic
import { jsonTree } from "https://deno.land/x/jsontree@{VERSION}/mod.ts";
console.log(
jsonTree({
apples: "gala", // ββ apples: gala
oranges: "mandarin", // ββ oranges: mandarin
}),
);CLI
Alternatively, you can use it directly from the CLI:
Read JSON from local directory
deno run --allow-read https://deno.land/x/jsontree@1.0.0/cli.ts path sample.jsonRead JSON from server
deno run --allow-net https://deno.land/x/jsontree@1.0.0/cli.ts fetch https://jsonplaceholder.typicode.com/usersInstall globally
deno install --allow-net --allow-read -n jsontree https://deno.land/x/jsontree@1.0.0/cli.tsThen, the binary is available to run:
jsontreeConfiguration
Required permissions:
--allow-net(if using clifetchoption)--allow-read(if using clipathoption or programmatic API)
Usage
jsonTree(obj, { showValues?: boolean })Where:
obj: json objectshowValues: whether or not to show the object values in the tree
Screenshots
With Values

Without Values

Acknowledgement
This is a fork of the original satty1987/json_tree module.