Convert string to json in jq

后端 未结 2 1154
臣服心动
臣服心动 2021-02-03 17:29

Background

I have a json file that contains a string of json within an object:

{
    \"requestType\": \"POST\",
    \"response\": {
        \"size\": 7         


        
2条回答
  •  既然无缘
    2021-02-03 18:05

    Use fromjson.

    It parses a string to its appropriate json value. tojson (and @json) goes the other way around and takes a json value and converts it to a string.

    So you could do this:

    .response.text | fromjson.title
    

提交回复
热议问题