应用JSON过滤器时如何仅选择值

时间:2019-03-19 16:58:13

标签: json jsonpath

我有以下JSON,我需要做两件事:

  1. 仅选择那些具有productionVersion属性的条目。这些条目仅显示ID。我设法使用此json路径$.configurations.[?(@.productionVersion)].id

  2. 从我进入#1的列表中仅选择一个ID。我无法做到这一点。我尝试了许多方法,寻找了具体的文档。我什么都找不到。

{
  "configurations": [
    {
      "description": "Helllo",
      "fileType": "RBAC",
      "id": 38936,
      "latestVersion": 1,
      "name": "1.SECKSD-1172",
      "stagingVersion": 1
    },
    {
      "description": "test",
      "fileType": "RBAC",
      "id": 22506,
      "latestVersion": 22,
      "name": "1108_hmm",
      "productionVersion": 22,
      "stagingVersion": 17
    },
    {
      "fileType": "RBAC",
      "id": 38923,
      "latestVersion": 1,
      "name": "1111.quicktest"
    },
    {
      "fileType": "RBAC",
      "id": 22369,
      "latestVersion": 26,
      "name": "17.10 Botman Release Test",
      "productionHostnames": [
        "*.bayo.endpoint.com",
        "www.testpapi.com",
        "www.mymovistar.es",
        "botman-debug.edgesuite.net",
        "www.konawatest1.com",
        "botman-lookup.edgesuite.net",
        "www.bayo.endpoint4.com",
        "browservalidation.dsenecal.com",
        "www.ksdpolicytest.com",
        "www.konawatest.com",
        "www.bayo.endpoint3.com",
        "www.kona-security-netstorage-test.com"
      ],
      "productionVersion": 25
    },
    {
      "description": "Throw this away",
      "fileType": "RBAC",
      "id": 11728,
      "latestVersion": 41,
      "name": "17.10 Release Test",
      "productionHostnames": [
        "ayah.dsenecal.com",
        "www.bayo.endpoint1.com",
        "*.mss.iss.dlr3.net",
        "www.bayo.endpoint2.com"
      ],
      "productionVersion": 34,
      "stagingVersion": 34
    },
    {
      "fileType": "RBAC",
      "id": 17027,
      "latestVersion": 31,
      "name": "17.2 Test New Security Config"
    },
    {
      "fileType": "RBAC",
      "id": 15231,
      "latestVersion": 2,
      "name": "FEO_test"
    },
    {
      "fileType": "RBAC",
      "id": 30428,
      "latestVersion": 1,
      "name": "FMA Testing in Prod"
    },
    {
      "fileType": "RBAC",
      "id": 31889,
      "latestVersion": 4,
      "name": "FMA-use case 10",
      "productionVersion": 4,
      "stagingVersion": 3
    },
    {
      "fileType": "RBAC",
      "id": 7003,
      "latestVersion": 139,
      "name": "For QA",
      "productionVersion": 135
    },
    {
      "description": "Gartner MQ Demo 99",
      "fileType": "RBAC",
      "id": 11726,
      "latestVersion": 4,
      "name": "Gartner MQ Demo 99"
    },
    {
      "description": "Testing SecMon bug",
      "fileType": "RBAC",
      "id": 30752,
      "latestVersion": 1,
      "name": "HAC-test",
      "productionHostnames": [
        "www.testcaptcha.com"
      ]
    },
    {
      "fileType": "RBAC",
      "id": 32197,
      "latestVersion": 1,
      "name": "Jamie Metadata Test"
    },
    {
      "fileType": "RBAC",
      "id": 15867,
      "latestVersion": 8,
      "name": "Jamie NLC Test Configuration",
      "productionHostnames": [
        "propmgr.staging.mtosches.wix.com"
      ],
      "productionVersion": 6,
      "stagingVersion": 8
    },
    {
      "fileType": "RBAC",
      "id": 16400,
      "latestVersion": 3,
      "name": "Jamie' WBS Test"
    },
    {
      "fileType": "RBAC",
      "id": 29126,
      "latestVersion": 1,
      "name": "Jamie's Botman Config (Don't touch)"
    },
    {
      "description": "Don't touch it, please",
      "fileType": "RBAC",
      "id": 29125,
      "latestVersion": 1,
      "name": "Jamie's Empty Config (Don't touch)"
    },
    {
      "fileType": "RBAC",
      "id": 32116,
      "latestVersion": 1,
      "name": "KSD E2E Ghost Automation"
    },
    {
      "fileType": "RBAC",
      "id": 30368,
      "latestVersion": 1,
      "name": "KSDOnlyRateControlE2EConfig",
      "stagingVersion": 1
    },
    {
      "fileType": "RBAC",
      "id": 20517,
      "latestVersion": 4,
      "name": "Kinjal CR 1.0 DO NOT DELETE"
    },
    {
      "fileType": "RBAC",
      "id": 38372,
      "latestVersion": 1,
      "name": "Kinjal Release New Config"
    },
    {
      "fileType": "RBAC",
      "id": 6100,
      "latestVersion": 60,
      "name": "Kinjal Release Test Config",
      "productionVersion": 60,
      "stagingVersion": 60
    },
    {
      "fileType": "RBAC",
      "id": 20537,
      "latestVersion": 2,
      "name": "Kinjal SIEM DO NOT DELETE"
    },
    {
      "fileType": "RBAC",
      "id": 19419,
      "latestVersion": 9,
      "name": "Kinjal test",
      "productionVersion": 8,
      "stagingVersion": 8
    },
    {
      "fileType": "RBAC",
      "id": 20469,
      "latestVersion": 1,
      "name": "Kinjal test 3"
    },
    {
      "fileType": "RBAC",
      "id": 20471,
      "latestVersion": 2,
      "name": "Kinjal test 5"
    },
    {
      "fileType": "RBAC",
      "id": 13407,
      "latestVersion": 15,
      "name": "KinjalTestConfig",
      "productionHostnames": [
        "www.business-solutions.telefonica.com"
      ],
      "productionVersion": 15,
      "stagingVersion": 15
    },
    {
      "fileType": "RBAC",
      "id": 17029,
      "latestVersion": 7,
      "name": "Kinjal_DO_NOT_DELETE",
      "productionVersion": 5,
      "stagingVersion": 7
    },
    {
      "fileType": "RBAC",
      "id": 20974,
      "latestVersion": 1,
      "name": "Kunal 17.8 Test"
    },
    {
      "fileType": "RBAC",
      "id": 22232,
      "latestVersion": 2,
      "name": "Kunal Release Test",
      "stagingVersion": 1
    },
    {
      "fileType": "RBAC",
      "id": 20801,
      "latestVersion": 2,
      "name": "MT test config"
    },
    {
      "description": "NEW RELEASE 080217",
      "fileType": "RBAC",
      "id": 20326,
      "latestVersion": 2,
      "name": "NEW RELEASE 080217"
    },
    {
      "fileType": "RBAC",
      "id": 37683,
      "latestVersion": 1,
      "name": "New"
    },
    {
      "fileType": "RBAC",
      "id": 28526,
      "latestVersion": 1,
      "name": "No Match Target"
    },
    {
      "fileType": "RBAC",
      "id": 17753,
      "latestVersion": 3,
      "name": "Patch Test"
    },
    {
      "fileType": "RBAC",
      "id": 25831,
      "latestVersion": 1,
      "name": "Release testing - Create"
    },
    {
      "fileType": "RBAC",
      "id": 18013,
      "latestVersion": 1,
      "name": "Rep1"
    },
    {
      "fileType": "RBAC",
      "id": 38747,
      "latestVersion": 1,
      "name": "Ruchi Clone Config Test"
    },
    {
      "fileType": "RBAC",
      "id": 38862,
      "latestVersion": 1,
      "name": "Ruchi's test config with conditions/exc"
    },
    {
      "fileType": "RBAC",
      "id": 10027,
      "latestVersion": 20,
      "name": "Senecal BotMan config",
      "productionVersion": 20,
      "stagingVersion": 20
    },
    {
      "fileType": "RBAC",
      "id": 11386,
      "latestVersion": 3,
      "name": "Staging"
    },
    {
      "fileType": "RBAC",
      "id": 35802,
      "latestVersion": 1,
      "name": "TK_test"
    },
    {
      "fileType": "RBAC",
      "id": 33821,
      "latestVersion": 1,
      "name": "Tadhg Activation Test 18.11",
      "stagingVersion": 1
    },
    {
      "fileType": "RBAC",
      "id": 35843,
      "latestVersion": 1,
      "name": "Tadhg Eval Test"
    },
    {
      "fileType": "RBAC",
      "id": 38763,
      "latestVersion": 2,
      "name": "Test",
      "productionHostnames": [
        "www.foobar2.com"
      ],
      "productionVersion": 1,
      "stagingVersion": 1
    },
    {
      "fileType": "RBAC",
      "id": 17706,
      "latestVersion": 1,
      "name": "Test 17.3 Release"
    },
    {
      "fileType": "RBAC",
      "id": 22236,
      "latestVersion": 1,
      "name": "Test 17.9 Release"
    },
    {
      "description": "Test 18.9 Release_Kunal",
      "fileType": "RBAC",
      "id": 32832,
      "latestVersion": 17,
      "name": "Test 18.9 Release_Kunal",
      "productionVersion": 12,
      "stagingVersion": 17
    },
    {
      "fileType": "RBAC",
      "id": 17026,
      "latestVersion": 4,
      "name": "Test AA"
    },
    {
      "fileType": "RBAC",
      "id": 16547,
      "latestVersion": 1,
      "name": "Test API - 2017"
    },
    {
      "fileType": "RBAC",
      "id": 15869,
      "latestVersion": 15,
      "name": "Test API Def 11/3",
      "productionVersion": 13
    },
    {
      "fileType": "RBAC",
      "id": 17752,
      "latestVersion": 1,
      "name": "Test API Def Fix"
    },
    {
      "fileType": "RBAC",
      "id": 15670,
      "latestVersion": 5,
      "name": "Test API Def ION"
    },
    {
      "fileType": "RBAC",
      "id": 15606,
      "latestVersion": 14,
      "name": "Test API definition",
      "productionVersion": 13
    },
    {
      "fileType": "RBAC",
      "id": 29467,
      "latestVersion": 1,
      "name": "Test APP LAyer"
    },
    {
      "fileType": "RBAC",
      "id": 33407,
      "latestVersion": 1,
      "name": "Test Activation 18.10",
      "productionVersion": 1
    },
    {
      "fileType": "RBAC",
      "id": 20948,
      "latestVersion": 1,
      "name": "Test Clone Custom Rules"
    },
    {
      "fileType": "RBAC",
      "id": 19746,
      "latestVersion": 3,
      "name": "Test Cloning"
    },
    {
      "fileType": "RBAC",
      "id": 21432,
      "latestVersion": 1,
      "name": "Test Config CLone",
      "stagingVersion": 1
    },
    {
      "fileType": "RBAC",
      "id": 29728,
      "latestVersion": 1,
      "name": "Test Create Config"
    },
    {
      "fileType": "RBAC",
      "id": 20978,
      "latestVersion": 1,
      "name": "Test Creation of sec file"
    },
    {
      "fileType": "RBAC",
      "id": 20815,
      "latestVersion": 1,
      "name": "Test Custom Rule Again"
    },
    {
      "fileType": "RBAC",
      "id": 32128,
      "latestVersion": 1,
      "name": "Test FMA Long"
    },
    {
      "fileType": "RBAC",
      "id": 20975,
      "latestVersion": 2,
      "name": "Test Kinjal test 5"
    },
    {
      "fileType": "RBAC",
      "id": 38293,
      "latestVersion": 1,
      "name": "Test Long Activation - Kunal",
      "stagingVersion": 1
    },
    {
      "fileType": "RBAC",
      "id": 38294,
      "latestVersion": 1,
      "name": "Test Long Activation1 - Kunal"
    },
    {
      "fileType": "RBAC",
      "id": 31033,
      "latestVersion": 1,
      "name": "Test New config file"
    },
    {
      "fileType": "RBAC",
      "id": 13884,
      "latestVersion": 1,
      "name": "Test Patch Demoted ACG"
    },
    {
      "fileType": "RBAC",
      "id": 13885,
      "latestVersion": 5,
      "name": "Test Patch SubAcg",
      "productionVersion": 5
    },
    {
      "fileType": "RBAC",
      "id": 22314,
      "latestVersion": 1,
      "name": "Test RC"
    },
    {
      "fileType": "RBAC",
      "id": 13883,
      "latestVersion": 2,
      "name": "Test Rep Patch Master"
    },
    {
      "fileType": "RBAC",
      "id": 19751,
      "latestVersion": 3,
      "name": "Test Reputation Clone"
    },
    {
      "fileType": "RBAC",
      "id": 16876,
      "latestVersion": 3,
      "name": "Test Reputation Exclude Flag"
    },
    {
      "fileType": "RBAC",
      "id": 20504,
      "latestVersion": 1,
      "name": "Test Sec Config"
    },
    {
      "fileType": "RBAC",
      "id": 30787,
      "latestVersion": 3,
      "name": "Test Secmon",
      "stagingVersion": 3
    },
    {
      "fileType": "RBAC",
      "id": 30917,
      "latestVersion": 2,
      "name": "Test Secmon Fix",
      "productionHostnames": [
        "b2b.div2.akamaniac.com"
      ]
    },
    {
      "fileType": "RBAC",
      "id": 13868,
      "latestVersion": 13,
      "name": "Test Sub ACG",
      "productionHostnames": [
        "test-uvm-97-qa.com.edgesuite-staging.net"
      ],
      "stagingVersion": 8
    },
    {
      "fileType": "RBAC",
      "id": 31888,
      "latestVersion": 6,
      "name": "Test WAF + AFTER FMA",
      "productionVersion": 5
    },
    {
      "fileType": "RBAC",
      "id": 8767,
      "latestVersion": 23,
      "name": "Test config",
      "productionHostnames": [
        "mtosches.wix.com.edgesuite-staging.net"
      ],
      "stagingVersion": 23
    },
    {
      "description": "Used for testing konaloadtest.akamized.net",
      "fileType": "RBAC",
      "id": 23843,
      "latestVersion": 1,
      "name": "Test in Production Config"
    },
    {
      "fileType": "RBAC",
      "id": 18250,
      "latestVersion": 1,
      "name": "Test_ATO_Feed"
    },
    {
      "fileType": "RBAC",
      "id": 36136,
      "latestVersion": 1,
      "name": "To BeDel"
    },
    {
      "fileType": "RBAC",
      "id": 21667,
      "latestVersion": 1,
      "name": "Vasu Sec"
    },
    {
      "fileType": "RBAC",
      "id": 11786,
      "latestVersion": 5,
      "name": "VasuTest",
      "productionVersion": 5,
      "stagingVersion": 4
    },
    {
      "fileType": "RBAC",
      "id": 11046,
      "latestVersion": 270,
      "name": "WBS Production_Ghost_Test_BotMan",
      "productionHostnames": [
        "www.kona-ghost-botman-cyberfend.com.edgesuite-staging.net",
        "www.kona-ghost-botman-ios-test.com",
        "www.kona-ghost-botman-ato-action-slow.com",
        "www.kona-ghost-botman-standard-install-essl.com",
        "www.kona-ghost-botman-android-test.com",
        "www.kona-ghost-botman-cyberfend-install-essl.com",
        "www.kona-ghost-botman-standard-install1.com",
        "www.kona-ghost-test-rate-control-botman.com",
        "www.kona-ghost-botman-slow.com",
        "www.kona-ghost-test-rate-control-botman-freeflow.com",
        "www.kona-ghost-adv-action-test-install1.com",
        "www.kona-ghost-botman-cyberfend-zone2.com",
        "www.kona-ghost-botman-ato-action-delay.com",
        "www.kona-ghost-botman-deny.com",
        "www.kona-ghost-test-rate-control-botman-zone2.com",
        "www.kona-ghost-botman-endpoint-pattern3.com",
        "www.kona-ghost-botman-ato-action-servealt.com",
        "www.kona-ghost-botman-standard-zone2.com",
        "www.kona-ghost-browservalidation-staging.com.edgesuite-staging.net",
        "www.kona-ghost-adv-action-test-zone1.com",
        "www.kona-ghost-botman-failed-login-tracking.com",
        "www.kona-ghost-botman-delay.com",
        "www.kona-botman-browser-test.com.edgesuite-staging.net",
        "www.kona-ghost-botman-condition.com",
        "www.kona-ghost-browservalidation-install1.com",
        "www.kona-ghost-adv-action-test-install-freeflow.com",
        "www.kona-ghost-botman-no-js-injection.com",
        "www.kona-ghost-browservalidation-install-essl.com",
        "www.kona-ghost-adv-action-test-zone2.com",
        "www.kona-ghost-botman-rule-fp-test.com",
        "www.kona-ghost-botman-endpoint-pattern1.com",
        "www.kona-ghost-botman-endpoint-pattern2.com",
        "www.kona-ghost-botman-ato-action.com",
        "www.kona-ghost-botman-tarpit.com",
        "www.kona-ghost-test-rate-control-botman-zone1.com",
        "www.kona-ghost-test-rate-control-botman-essl.com",
        "www.kona-ghost-botman-cyberfend-install1.com",
        "www.kona-ghost-netstorage-acs.com",
        "www.kona-ghost-browservalidation-zone1.com",
        "www.kona-ghost-botman-standard-zone1.com",
        "www.kona-ghost-test-rate-control-botman.com.edgesuite-staging.net",
        "www.kona-ghost-botman-cyberfend-injection.com",
        "www.kona-ghost-browservalidation.com",
        "www.kona-ghost-botman-serve-alt.com",
        "www.kona-ghost-adv-action-test.com",
        "www.kona-bmp-production-monitor.akamaized.net",
        "www.kona-ghost-botman-standard-install-freeflow.com",
        "www.kona-botman-browser-test.com",
        "www.kona-ghost-browservalidation-install-freeflow.com",
        "www.kona-ghost-botman-ato-action-tarpit.com",
        "www.kona-ghost-test-rate-control-botman-install1.com",
        "www.kona-ghost-botman-delay.com.edgesuite-staging.net",
        "www.kona-ghost-botman-overlapping-purposes.com",
        "www.kona-ghost-botman-endpoint-pattern4.com",
        "www.kona-ghost-botman-endpoint-pattern5.com",
        "www.kona-ghost-adv-action-test.com.edgesuite-staging.net",
        "www.kona-ghost-botman-cyberfend.com",
        "www.kona-ghost-browservalidation-zone2.com",
        "www.kona-ghost-botman-cyberfend-install-freeflow.com",
        "www.kona-ghost-botman-ato-conditional-action.com",
        "www.kona-ghost-botman-monitor.com",
        "www.kona-ghost-botman-ato-action-ignore.com",
        "www.kona-ghost-botman-cyberfend-zone1.com",
        "www.kona-ghost-adv-action-test-install-essl.com"
      ],
      "productionVersion": 258,
      "stagingVersion": 270
    }
  ]
}

0 个答案:

没有答案