
Security News
Deno Goes the Way of the Dinosaur
Cloudflare is acquiring Deno’s team, which will provide another year of bug fixes and security updates before ending support for the runtime.
A small command-line tool to parse JSON and log it with the desired object depth
A small command-line tool to walk through the depth levels of a json objects
output json | jd <PATH>=. <DEPTH>=0

Working with super deep json objects from the terminal is a pain, unless you use a good json parser.
jq is an awesome one, but doesn't handle object depths, afaik.
Here the idea is to walk through a json object as you would read a summary: level by level.
npm install -g jsondepth
real world example:
url='https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q1&format=json'
curl -s "$url" | jsondepth
logs the object with only the first-level keys and values:
{ entities: [Object], success: 1 }
for the sake of convenience and lazyness, jsondepth is aliased to jd
(which, purposedly make it look a bit like jq)
curl -s "$url" | jd
this is equivalent to the two previous one:
curl -s "$url" | jd 0
now let's go one-level deeper:
curl -s "$url" | jd 1
outputs:
{ entities: { Q1: [Object] }, success: 1 }

curl -s "$url" | jd 2
curl -s "$url" | jd 3
curl -s "$url" | jd 4
# etc
If you use [paths](#specify-a-path), you may wish to disable object wrapping: this can be done by passing `-1`. The advantage is that you are sure to get back a valid json object.
curl -s "$url" | jd -1
curl -s "$url" | jd entities.Q1.aliases.fi.1
# or to mimick jq syntax
curl -s "$url" | jd .entities.Q1.aliases.fi.1
# or with keys with spaces
curl -s "$url" | jd .entities.Q1.['a key with spaces']
if both a path and a depth are specified, path should come first, depth second
curl -s "$url" | jd entities.Q1.claims.P31.0 3
lengthcurl -s "$url" | jd entities.Q1.aliases.en.length
# => 5
_keysapply Object.keys to the final object
curl -s "$url" | jd entities._keys
# => ['Q1']
_valuesapply _.values to an array
curl -s "$url" | jd entities._values
# => [{ id: 'Q1', etc...}]
curl -s "$url" | jd entities._values.0.id
# => 'Q1'
_mapmap properties of an array
curl -s "$url" | jd entities._values._map.id
# => ['Q1']
_firstecho '["foo", "bar"]' | jd ._first
# => foo
_lastecho '["foo", "bar"]' | jd ._first
# => bar
Wrapped results like { entities: { Q1: [Object] }, success: 1 } are more readible but aren't valid JSON. And sometimes, for whatever reason, you want a valid JSON output; there in a option for that: --json|-j
curl -s "$url" | jd entities.Q1.aliases --json
You can even specify the output indentation level (Between 0 and 9. Default: 2):
curl -s "$url" | jd entities.Q1.aliases --json=0
curl -s "$url" | jd entities.Q1.aliases --json=4
Notice that it disables the depth option as it's responsible for the wrapping mechanism.
Add the --line option to parse the stdin line by line
curl https://some.ndjson.dump | jd --line .key
There is a tolerance for JSON lines ending by a comma, and any line that isn't starting by a { or a } is ignored.
FAQs
A small command-line tool to parse JSON and log it with the desired object depth
The npm package jsondepth receives a total of 6 weekly downloads. As such, jsondepth popularity was classified as not popular.
We found that jsondepth demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.

Security News
Cloudflare is acquiring Deno’s team, which will provide another year of bug fixes and security updates before ending support for the runtime.

Security News
Anthropic’s free OSS Scanner uses Mythos and other Claude models to find open source vulnerabilities and send maintainers reports with proposed fixes.

Security News
On Front Lines’ Early Adopters: CISO podcast, Andrew Becherer shares lessons from Datadog, weighs the long-term costs of AI-built tools, and explains how founders can actually gain a CISO’s trust.