Parse simple JSON string in Batch

后端 未结 5 1885
执笔经年
执笔经年 2020-12-16 00:36

How do you parse a simple JSON string in Batch?

For example, if I have the following JSON string:

{ \"...\":\"...\", \"year\": 2016, \"time\": \"05:01\

5条回答
  •  执笔经年
    2020-12-16 01:09

    Use https://stedolan.github.io/jq/, no need to use powershell or string manipulations in batch.

    Example to get value of field from json string:

    set "year={ "other": 1234, "year": 2016, "value": "str", "time": "05:01" } | jq .year"
    
    echo %year%
    

    gives you 2016

提交回复
热议问题