小编Rag*_*rni的帖子

如何使用 jq 将 json 部分添加到现有文件

我正在使用它jq来解析 JSON 文件。我有 JSON 文件的某些部分,内容如下

[
  {
    "PropagateAtLaunch": true,
    "Value": {
      "Ref": "TNAM"
    },
    "Key": "Name"
  },
  {
    "PropagateAtLaunch": true,
    "Value": {
      "Ref": "TAPP"
    },
    "Key": "application"
  },
  {
    "PropagateAtLaunch": true,
    "Value": {
      "Ref": "TENV"
    },
    "Key": "environment"
  },
  {
    "PropagateAtLaunch": true,
    "Value": {
      "Ref": "TSHA"
    },
    "Key": "shared"
  },
  {
    "PropagateAtLaunch": true,
    "Value": {
      "Ref": "TTER"
    },
    "Key": "tier"
  },
  {
    "PropagateAtLaunch": true,
    "Value": {
      "Ref": "CostCenter"
    },
    "Key": "cost-center"
  }
]
Run Code Online (Sandbox Code Playgroud)

在此我想添加另一个部分,例如:

{
  "Value": {
    "Ref": …
Run Code Online (Sandbox Code Playgroud)

bash jq

1
推荐指数
1
解决办法
2956
查看次数

标签 统计

bash ×1

jq ×1