1

Below is the JSON content on which I was trying to extract the contents of matched filters

{
        "results": [{
                "individualProviderId": "P1",
                "locations": [{
                        "addressInfo": {
                            "city": "Pembroke Pines",
                            "county": "Broward",
                            "state": "FL",
                            "zip": "33026"
                        },
                        "plans": [{
                                "networkId": "N1",
                                "tiering": [{
                                        "policyPlanID": "PP1"
                                    }, {
                                        "policyPlanID": "PP2"
                                    }, {
                                        "policyPlanID": "PP3"
                                    }, {
                                        "policyPlanID": "PP4"
                                    }
                                ]
                            }, {
                                "networkId": "N2",
                                "tiering": [{
                                        "policyPlanID": "PP5"
                                    }, {
                                        "policyPlanID": "PP8"
                                    }
                                ]
                            }, {
                                "networkId": "N3",
                                "tiering": [{
                                        "policyPlanID": "PP1"
                                    }, {
                                        "policyPlanID": "PP9"
                                    }
                                ]
                            }, {
                                "networkId": "N4",
                                "tiering": [{
                                        "policyPlanID": "PP7"
                                    }
                                ]
                            }
                        ]
                    }, {
                        "addressInfo": {
                            "city": "Pembroke Pines2",
                            "county": "Broward2",
                            "state": "FL2",
                            "zip": "330262"
                        },
                        "plans": [{
                                "networkId": "N2",
                                "tiering": [{
                                        "policyPlanID": "PP5"
                                    }
                                ]
                            }

                        ]
                    }

                ]
            },
            {
                "individualProviderId": "P2",
                "locations": [{
                        "addressInfo": {
                            "city": "Pembroke Pines",
                            "county": "Broward",
                            "state": "FL",
                            "zip": "33026"
                        },
                        "plans": [{
                                "networkId": "N1",
                                "tiering": [{
                                        "policyPlanID": "PP5"
                                    }
                                ]
                            }, {
                                "networkId": "N2",
                                "tiering": [{
                                        "policyPlanID": "PP1"
                                    }, {
                                        "policyPlanID": "PP5"
                                    }
                                ]
                            }
                        ]
                    }, {
                        "addressInfo": {
                            "city": "Pembroke Pines2",
                            "county": "Broward2",
                            "state": "FL2",
                            "zip": "330262"
                        },
                        "plans": [{
                                "networkId": "N2"
                            }

                        ]
                    }

                ]
            }
        ],
        "status": "OK"
    }

JSONPath expression : $..tiering[?(@.policyPlanID == 'PP1')])

Matched Values are

[
   {
      "policyPlanID" : "PP1"
   },
   {
      "policyPlanID" : "PP1"
   },
   {
      "policyPlanID" : "PP1"
   }
]

Question is there any API to preserve the contents of Whole JSON result from root level ? And Is there any specific API to get the results of Paths

[
   "$['results'][0]['locations'][0]['plans'][0]['tiering'][0]",
   "$['results'][0]['locations'][0]['plans'][2]['tiering'][0]",
   "$['results'][1]['locations'][0]['plans'][1]['tiering'][0]"
]
Syed Rafi
  • 825
  • 2
  • 12
  • 35

0 Answers0