0

我有这个 JSON 对象:

{
            id: {
              name: "BBCommercialPropertyStructureFloodCoverage",
            },
            carrierData: null,
            link: [
              {
                key: "Location",
                select: {
                  key: "ARRAY_INDEX",
                  value: 0,
                },
              },
              {
                key: "structure",
                select: {
                  key: "ARRAY_INDEX",
                  value: 1,
                },
              },
              {
                key: "Coverage",
                select: {
                  key: "ARRAY_INDEX",
                  value: 0,
                },
              },
            ],
          },

我有几个具有不同索引值的对象。例如,如果我想对此进行匹配,id/name: "BBCommercialPropertyStructureFloodCoverage"并且位置值为 0,结构值为 1,我该如何使用 jmespath 来做到这一点?

到目前为止我有这个:

const floodCoverageQuery = [?id.name=='BBCommercialPropertyStructureFloodCoverage' && link[key=='Location' && select.value==0]] && link[key=="structure" && select.value==1]]

这是正确的吗?

4

1 回答 1

2
于 2018-12-08T15:41:00.980 回答