Parse and store text from a json file in windows batch script

青春壹個敷衍的年華 提交于 2020-01-23 01:37:45

问题


I have a json file with the following contents

{"STATUS":"PASS","PASSRATE":96.95238}

I want to store the passrate so that I can use it to append to a filename.


回答1:


Check jsonextractor.bat with which you can extract information from json file by given dot notated path to object:

jsonextractor.bat data.json PASSRATE



回答2:


You could use Xidel for that:

xidel -s data.json -e "$json/PASSRATE"


来源:https://stackoverflow.com/questions/47048992/parse-and-store-text-from-a-json-file-in-windows-batch-script

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!