Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
DiliTimor
Contributor III
Contributor III

json xpath loop query

Dear Fellow,

I had an json schema just like this:

{

 "statusCode": 200,

 "result": {

  "type": "Topology",

  "objects": {

   "output": {

    "type": "GeometryCollection",

    "geometries": [

     {

      "type": "Point",

      "properties": {

       "pkey": "307014",

       "created_at": "2022-10-07T07:55:03.649Z",

       "source": "grasp",

       "status": "confirmed",

       "url": "4f79bb30-91f7-4f63-9287-3ccb101b5d73",

       "image_url": "https://images.petabencana.id/4f79bb30-91f7-4f63-9287-3ccb101b5d73.jpg",

       "disaster_type": "flood",

       "report_data": {

        "report_type": "flood",

        "flood_depth": 89

       },

       "tags": {

        "district_id": null,

        "local_area_id": null,

        "instance_region_code": "ID-JT"

       },

       "title": null,

       "text": "# simulasipekalongan\nberita banjir rob terkini\n5000 warga terdampak banjir\n200 anak-anak\n150 balita",

       "partner_code": null,

       "partner_icon": null

      },

      "coordinates": [

       109.6194396486,

       -7.0385461634

      ]

     },

     {

      "type": "Point",

      "properties": {

       "pkey": "307013",

       "created_at": "2022-10-07T06:22:00.269Z",

       "source": "grasp",

       "status": "confirmed",

       "url": "9f43d77b-02aa-43b7-95d3-4e9acdb5f7c4",

       "image_url": "https://images.petabencana.id/9f43d77b-02aa-43b7-95d3-4e9acdb5f7c4.jpg",

       "disaster_type": "flood",

       "report_data": {

        "report_type": "flood",

        "flood_depth": 77

       },

       "tags": {

        "district_id": null,

        "local_area_id": null,

        "instance_region_code": "ID-JT"

       },

       "title": null,

       "text": "# sinulasipekalongan terjadi bencana banjir rob dengan ketinggian 5 meter\n10 rw terkena dampak \n5 kelurahan mengalami kerusakan",

       "partner_code": null,

       "partner_icon": null

      },

      "coordinates": [

       109.6281136467,

       -6.8474412604

      ]

     }

    ]

   }

  },

  "arcs": [

    

  ],

  "bbox": [

   109.6194396486,

   -7.0385461634,

   109.6281136467,

   -6.8474412604

  ]

 }

}

I would like to parse those schema using tFileInputJson

0695b00000WvqphAAB.png

It did work but the result is empty columns

Any suggestion to make it work?

Thank you in advance

Labels (4)
1 Solution

Accepted Solutions
Anonymous
Not applicable

I would set "Read By" to "JSONPath", set your "Loop JSON query" to....

 

$.result.objects.output.geometries

 

....and then take another look at your some of your mappings for the appropriate JSONPath queries.

 

Take a look at this website to make finding JSONPath queries easier.....

 

https://jsonpathfinder.com/

 

Keep in mind that your "Loop JSON query" is where the queries start from in the mapping. So, if the website above gives you a path like this to one of your fields.....

 

x.result.objects.output.geometries[0].properties.pkey

 

.... your query for this column will be....

 

"properties.pkey"

 

 

View solution in original post

2 Replies
Anonymous
Not applicable

I would set "Read By" to "JSONPath", set your "Loop JSON query" to....

 

$.result.objects.output.geometries

 

....and then take another look at your some of your mappings for the appropriate JSONPath queries.

 

Take a look at this website to make finding JSONPath queries easier.....

 

https://jsonpathfinder.com/

 

Keep in mind that your "Loop JSON query" is where the queries start from in the mapping. So, if the website above gives you a path like this to one of your fields.....

 

x.result.objects.output.geometries[0].properties.pkey

 

.... your query for this column will be....

 

"properties.pkey"

 

 

DiliTimor
Contributor III
Contributor III
Author

Thank You @Richard Hall​ 

 

this site https://jsonpathfinder.com/ really useful