Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE

REST connector loads a large number of table from a nested JSON or XML response

No ratings
cancel
Showing results for 
Search instead for 
Did you mean: 
Sonja_Bauernfeind
Digital Support
Digital Support

REST connector loads a large number of table from a nested JSON or XML response

Last Update:

Apr 12, 2022 8:31:46 AM

Updated By:

Sonja_Bauernfeind

Created date:

May 14, 2019 10:03:51 AM

When using Qlik REST connector to load data from API sources that return JSON or XML response, sometimes a huge data model with many tables is returned although the response contains only a single table.
For example, the following JSON message is parsed into 5 single-row tables instead of one table with 5 rows:

000074304a.png

 

Environment:

  • Qlik REST connector 2.11.0 (default connector in Qlik Sense April 2019)

Cause:


The JSON response has a "nested" structure, i.e each data record is stored as a separated JSON object, which is not member of an array.

Qlik REST connector applies a standard strategy for parsing JSON response:

  • Each stand-alone object {..} (not being element of an array) is parsed as a new table
  • Each array [..] is parsed as a new table. If the array contains multiple objects, each object will take one line in the resulting table

As a result, nested JSON response is parsed as multiple tables instead of a single flat table. You can find the same strategy in other JSON parsing tool, such as http://json2table.com/.

The same logic applies to nested XML responses.

 

Resolution:


Qlik REST connector does not yet support loading JSON/ XML responses with nested structure. There is an ongoing improvement request to support this structure in future releases of the connector.
Meanwhile, please consider the following work-around solution:

  • For XML: Use a WebFile connection to load the response instead of REST connector. WebFile connection supports reading XML with [XmlSimple, table is...] instruction, which works with nested XML tables. Check the following community discussion for more details: https://community.qlik.com/t5/Qlik-Sense-Data-Connectivity/Can-I-query-nested-XML-data-over-REST-suc...
  • For both:
    • Develop an external script (such as Python) to download, parse the JSON/ XML response and store the flat table into a local data file. Use EXECUTE command to trigger the external script from Qlik and load data from the file.
    • If you have access to modify the API source, adjust the response format so that each record is stored as a member object of an array. For instance, the example above can be adjusted as follows:

000074304b.png

 

Labels (2)
Comments
p_verkooijen
Partner - Specialist
Partner - Specialist

"Qlik REST connector does not yet support loading JSON/ XML responses with nested structure. There is an ongoing improvement request to support this structure in future releases of the connector."

Is this ever going to be fixed in the REST connector? 

2 years ago allready that the connector would be enhanced, and yet still the same.

 

Sonja_Bauernfeind
Digital Support
Digital Support

Hello @p_verkooijen 

If none already exists (I checked and couldn't immediately find one) I would recommend logging a Feature Request/Idea and linking it back to this article. This will help our developers understand the need for it by our customer base.

Ideas 

All the best,
Sonja 

Version history
Last update:
‎2022-04-12 08:31 AM
Updated by: