I have this JSON
file called test.json
which says:
{
"test":true,
"limit":
{
"min":0.5,
"max":1.5
}
}
I'd like to be able to read this file in the Windows command line and have these objects parsed as variables.
How would I do this?
If you use Windows Powershell as your command line, you can use the ConvertFrom-JSON
cmdlet: http://powershelljson.codeplex.com/
Make sure your PowerShell version is above 3.0, as ConvertFrom-JSON is available from that version.
If you use plain old CMD, you'll need an external tool for it. I like jq: http://stedolan.github.io/jq/. The tutorial uses curl
for the examples, but you can just as easily use echo
or read the JSON from a file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With