I'd like to be able to read this file in the Windows command line and have these objects parsed as variables.
I'll interpret this as, you want to do:
SET min=0.5
SET max=1.5
I'd recommend the powerful tool xidel
for this task.
Basic command:
xidel -s test.json -e "$json/limit/min" -e "$json/limit/max"
xidel -s test.json -e "$json/limit/(min,max)"
Whether you use 2 queries to return each value, or 1 query to return both values, both commands should return:
0.5
1.5
Export with custom variable-names:
FOR /F "delims=" %A IN ('xidel -s test.json -e "min:=$json/limit/min" -e "max:=$json/limit/max" --output-format^=cmd') DO %A
FOR /F "delims=" %A IN ('xidel -s test.json -e "$json/limit/(min:=min,max:=max)" --output-format^=cmd') DO %A
Both commands do:
SET min=0.5
SET max=1.5
Export with key-names as variable-names:
FOR /F "delims=" %A IN ('xidel -s test.json -e "$json/(limit)() ! eval(x'{.}:=$json/limit/{.}')[0]" --output-format^=cmd') DO %A
To answer my own question: FOR /F "delims=" %%i in ('type test.json ^| jq .limit.min') DO SET min=%%i
If that's all you want, then...
FOR /F "delims=" %A IN ('xidel -s test.json -e "$json/limit/min"') DO SET min=%A
or...
FOR /F "delims=" %A IN ('xidel -s test.json -e "min:=$json/limit/min" --output-format^=cmd') DO %A
...is all you need.