JOLT在键名和键:值之间匹配的数组中转换值

时间:2019-12-18 13:23:59

标签: jolt

我想将JSON数组值(由时间戳和值组成)转换为基本数组key:value,每个元素的键名与另一个键中的值匹配。 例如dataResult.dataPoints.APPLICATION-3B30B3D26DC21ABF对应于实体。APPLICATION-3B30B3D26DC21ABF

输入JSON:

 {
  "dataResult": {
    "dataPoints": {
      "APPLICATION-3B30B3D26DC21ABF": [
        [
          1576666800000,
          0.93
        ]
      ],
      "APPLICATION-7A4CC746AFE107CF": [
        [
          1576666800000,
          0.94
        ]
      ],
      "APPLICATION-85E46F50199F9343": [
        [
          1576666800000,
          0.94
        ]
      ],
      "APPLICATION-56B77CE7058BCDC9": [
        [
          1576666800000,
          1
        ]
      ],
      "APPLICATION-54C60223A9C3CB79": [
        [
          1576666800000,
          0.77
        ]
      ],
      "APPLICATION-7D937876E12DF16E": [
        [
          1576666800000,
          0.7
        ]
      ],
      "APPLICATION-E5F12E17B9230E45": [
        [
          1576666800000,
          0.89
        ]
      ],
      "APPLICATION-B0C548C63F77A457": [
        [
          1576666800000,
          0.96
        ]
      ],
      "APPLICATION-EB32F9F0F38F2805": [
        [
          1576666800000,
          0.8
        ]
      ],
      "APPLICATION-6823E809F327C113": [
        [
          1576666800000,
          0.85
        ]
      ],
      "APPLICATION-EA7C4B59F27D43EB": [
        [
          1576666800000,
          0.77
        ]
      ],
      "APPLICATION-D9551FF96744C1F0": [
        [
          1576666800000,
          0.82
        ]
      ]
    },
    "entities": {
      "APPLICATION-56B77CE7058BCDC9": "Application1",
      "APPLICATION-EA7C4B59F27D43EB": "Application2",
      "APPLICATION-D9551FF96744C1F0": "Application3",
      "APPLICATION-6823E809F327C113": "Application4",
      "APPLICATION-54C60223A9C3CB79": "Application5",
      "APPLICATION-3B30B3D26DC21ABF": "Application6",
      "APPLICATION-E5F12E17B9230E45": "Application7",
      "APPLICATION-B0C548C63F77A457": "Application8",
      "APPLICATION-7A4CC746AFE107CF": "Application9",
      "APPLICATION-7D937876E12DF16E": "Application10",
      "APPLICATION-EB32F9F0F38F2805": "Application11",
      "APPLICATION-85E46F50199F9343": "Application12"
    }
}
}

预期输出:

{
  "apdex": [
    {
        "application_name": "Application1",
        "application_id": "APPLICATION-56B77CE7058BCDC9",
        "timestamp": 1576666800000,
        "apdex_value": 1
    },
    {
        "application_name": "Application2",
        "application_id": "APPLICATION-EA7C4B59F27D43EB",
        "timestamp": 1576666800000,
        "apdex_value": 0.77
    },
    ....  for each application
  ]
}

您能帮我解决这个问题吗?

谢谢 问候 纪尧姆

0 个答案:

没有答案