Get Free Trial

Improve the loading time when connecting to a remote json data source

Answered
Martial Tchuente N. asked on March 3, 2021

Hello,
I once asked how to solve this problem and one option you suggested among others was the one below:
You could also try using gzip compression to compress the JSON-data response on the server-side, thereby decreasing the size of the dataset transferred through the network.
I’m inclined to try this option, but after compression I end up with a .zip file. 
My question now is how do I consume that remote .zip file in my pivot table? When I try I get an error: “JSON data is invalid
This is how I’m trying to connect to the remote compressed file:
dataSource: {
        type: “json”,
        filename: “https://api.xxx.com/…/file.zip”,
 
Regards. 

1 answer

Public
Milena Pechura Milena Pechura Flexmonster March 5, 2021

Hello!
 
Thank you for writing to us.
 
Our team would like to kindly suggest trying to configure the gzip compression rather than zip. We will provide some explanations on this below.
 
The idea of gzip compression is that it can be enabled on the server, so the communication between the browser and the server will look like this: 
1) The browser sends a header telling the server it accepts compressed content. Thereby, it asks the server if the compressed version of a file is available.

Accept-Encoding: gzip, deflate

2) The server sends a response if the content is actually compressed.

Content-Encoding: gzip

3) The browser takes the file and unzip it.
 
Thus, the link to the file will be specified in this way: 

filename: "…/file.json"

To sum up, all you need is to configure the compression in the settings of your server, which depend on the type of server you have.
Speaking about the client side, all modern browsers accept gzip encoding by default.
 
Please let us know if our response helped and if any further questions arise.
 
Best regards,
Milena

Please login or Register to Submit Answer