Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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?
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.
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)
;
Unfortunately, reading nested structures is what I need...
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);
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.
I get the following error when I use the From_Field function:
This is my code:
Any help is appreciated!
Hi Petter,
Do you have any solution data load "Qliksense "read the SQL table having couple of fields having various JSON format values ,what is appropriate way to LOAD in model.
Kindly suggest if you aware
Thanks
Harshal
I got the same error, did you find any solution for this?