JSON REPL?

50 views
Skip to first unread message

// ravi

unread,
May 6, 2014, 10:27:08 AM5/6/14
to nod...@googlegroups.com

Anyone know if there exists a tool that provides a REPL-like interface (i.e., interactive CLI) to JSON? Something using which I can do:

$ jsonrepl ./myfile.json
json> show
{
    “k1” : “val1”,
    “k2” : true,
    “k3” : { “k31” : “val31”, “k32” : “val32” }
}
json> cd “k3”
json> show
{
    “k31” : “val31”,
    “k32” : “val32”
}
json> set k31 = val31new
json> cd ..
json> print k1.k31
“val31new”

… etc …

I want to check before I write one.

—ravi


Xavi Ramirez

unread,
May 6, 2014, 8:04:42 PM5/6/14
to nod...@googlegroups.com
I usually use node's repl to explore json:

> obj = require("./myfile")
> obj["k3"]
> obj["k3"] = "foo"
etc...


--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/1F244BC8-1416-4219-9E1E-1FBE9F4498E6%40g8o.net.
For more options, visit https://groups.google.com/d/optout.

// ravi

unread,
May 6, 2014, 9:08:39 PM5/6/14
to nod...@googlegroups.com
On May 6, 2014, at 8:04 PM, Xavi Ramirez <xavi...@gmail.com> wrote:
I usually use node's repl to explore json:

> obj = require("./myfile")
> obj["k3"]
> obj["k3"] = "foo"
etc...


Xavi, thank you for the response. The above is indeed what got me thinking :-). It’s what I do and while trying to explain it to a non-tech person, I realised I could simplify the process for him if I removed some of the Node/JS specific actions.

Regards,

—ravi

Branden Visser

unread,
May 6, 2014, 9:29:45 PM5/6/14
to nod...@googlegroups.com
Not sure if there is anything already, but implementing a little
prompt loop and taking the JSONPath module [1] for a spin might be a
fun little project to help others learn how to navigate and slice
JSON.

Cheers,
Branden

[1] https://www.npmjs.org/package/JSONPath
> --
> Job board: http://jobs.nodejs.org/
> New group rules:
> https://gist.github.com/othiym23/9886289#file-moderation-policy-md
> Old group rules:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> ---
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to nodejs+un...@googlegroups.com.
> To post to this group, send email to nod...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/nodejs/2AEA4DB8-80AA-4F36-91C9-F52A7E178706%40g8o.net.
Reply all
Reply to author
Forward
0 new messages