Home > Net >  jq parsing complex json
jq parsing complex json

Time:11-28

I need to parse the below complex json and output the result to a file. I was able to parse the .result object. however I need to parse the list "com.src.main.client.details" and pipe it to another file.

I tried below command but it fails.

$> jq ".result[0].com.src.main.client.details" temp.json > result.json

null

can someone please assist me here.

"results": [
{"com.src.main.client.details":{
  "doc": "string",
  "details": [
    {
      "amount": null,
      "output": null,
     "properties": [
     {
     "characteristic": [],
     "component": null,
     "period": null,
     "internals": {
     "Currency": "EUR",
     "value": 0
   }
  }
 }```

CodePudding user response:

Use double quotes for keys that contain non-alphanumeric characters:

.results[0]."com.src.main.client.details"
  • Related