I would like to get data from a *.json file into file.txt with batch.
My JSON file config.json:
"nodes": [
{
"id": "item1",
"host": "${host:item1}",
"apps": [
{
"id": "value1",
"template_id": "value1"
},
{
"id": "value2",
"template_id": "value2",
},
I want to get only the values value1 and value2 of id elements of node apps. But the problem on using the command find in my script is actually that it reads the values of id and template_id.
Is it possible to get the value to id and not template_id?
I tried this... still not working...
setlocal EnableDelayedExpansion
set c=0
for /f "tokens=2 delims=:, " %%a in (' find "id" ^< "config.json" ') do (
set /a c+=1
set val[!c!]=%%~a
)
for /L %%b in (1,1,!c!) do echo !val[%%b]!
And after that, I don't know really how to get all these data in my text file.