简体   繁体   English

jq解析复杂json

[英]jq parsing complex json

I need to parse the below complex json and output the result to a file.我需要将以下复杂的 json 和 output 结果解析到文件中。 I was able to parse the.result object.我能够解析.result object。 however I need to parse the list "com.src.main.client.details" and pipe it to another file.但是我需要将列表“com.src.main.client.details”和 pipe 解析到另一个文件。

I tried below command but it fails.我尝试了以下命令,但失败了。

$> jq ".result[0].com.src.main.client.details" temp.json > result.json $> 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
   }
  }
 }```

Use double quotes for keys that contain non-alphanumeric characters:对包含非字母数字字符的键使用双引号:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM