Help Center

JSON Response

Last Updated: Sep 28, 2016 09:54AM PDT

In this featured article, our Resident Lead Engineer Dom Deren explains the JSON response.


 
Normal JSON looks like this:


While New Line delimited JSON looks like this:


It is a bit different structure, as in the first example we are sending only one JSON object, while in the second we send multiple objects. The second syntax is not recognised by browsers as valid JSON file, and cannot be automatically parsed as JSON object in JavaScript code.

We are aware that this kind of syntax can be confusing for developers, believe me we are using this syntax as well, and we have to add some additional processing around it, to support this format in our frontend applications.
  
But this format brings us also a few advantages, for which it is worth it to add some additional processing. The second format is really good for fast processing, list data. If we have stuff like list of URLs, or list of results from the execution done over time, it is much better to save those results, in the second format. It is much faster to save data in this format, because it is a simple append only operation for the file where the results are stored. It is also much faster to read, if you are not interested in the end of the list, before you start displaying the beginning of it. In other words, you don’t need to download the whole file, to start seeing meaningful results. This is really important with big data dumps, like our results. If your Extractor returned 400k rows, believe me you don’t really want to open this file in a usual text editor. Even Google Docs might have problem with processing such a file. But if the file is saved in the second format, you can easily have a look at the first 100 results, and later simply paginate through the rest, making it possible to easily display such results even on mobile devices.
 
So in case you are wondering how to programatically process the New Line Delimited format of our Extractor Run JSON result, hopefully the code snippet below will be able to help. It is a simple code written in JavaScript, that downloads the result file from our API, and displays each line in the file.

 

c2d12fc2f876f019701e1c3951e354bd@importio.desk-mail.com
http://assets2.desk.com/
false
desk
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete