Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
BARC’s The BI Survey 19 makes it official. BI users love Qlik. GET REPORT
Partner
Partner

Parsing JSON in QlikSense?

Hi everyone

Let's say I have a json string in a QlikSense script, like:

let x = '{"name":"foo", "surname":"bar"}';

Can I read a specific value from it, like for example the "name" value, without having to manually manipulate the string? In other words, is there a JSON parser in QlikSense?

6 Replies
MVP
MVP

Re: Parsing JSON in QlikSense?

There is a JSON parser in Qlik Sense although it hasn't been documented. Maybe that is because it only handles "flat" JSON files and not nested structures - I don't know.

It can not be invoked on variables but it can read JSON from files.

MVP
MVP

Re: Parsing JSON in QlikSense?

An example with your specific JSON in a file called test.json would look like this:

LOAD

    name, surname

FROM [lib://DATA/test.json] (json)

;

Partner
Partner

Re: Parsing JSON in QlikSense?

Unfortunately, reading nested structures is what I need...

Highlighted
MVP
MVP

Re: Parsing JSON in QlikSense?

It is also possible to load from an INLINE table like this:

SOMEJSON:

LOAD * INLINE [

json_field

{"name":"foo", "surname":"bar"}

{"name":"barry", "surname":"fool"}

{"name":"fu", "surname":"bal"}

] (txt,delimiter is \t);


PARSED_JSON:

LOAD

  name,

  surname

FROM_FIELD

  ( SOMEJSON,json_field ) (json);





2018-06-08 15_32_51-Microsoft Edge.png

MVP
MVP

Re: Parsing JSON in QlikSense?

Well then you will have to resort to much more load script scripting... It can become pretty complicated if you want want to be able any type of nested nested structure. But if it is a predefined and well-defined static structure with very few levels it would absolutely be feasible.

Partner
Partner

Re: Parsing JSON in QlikSense?

Hi Petter,
How did you find out about this feature?
Cheers,
Rick