Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] tRESTClient - How to parse the JSON result

Hi,
I didn't find any example or tutorial how to handle the JSON response of a tRESTClient POST request.
The encoded JSON comes in the string field in the response and how can I decode and map it so I can use it's values directly for a next step (UPDATE a database row with the fields).
The response contains objects in objects, so for example:
{
"vendor":
{
"uuid":1234,
"externalId":2345,
"details":
{
"currency":"EUR",
"quality":1
}
}
}

I tried and played around with the tExtractJSONFields but I don't get it. Always outputting 0 rows. (from the tRestClient come 2 in the Response output)
My settings so far:
Scheme: same as tRESTClient (ResponseCode, Body, String)
JSON field: string
Loop XPath Query: "string" (? - what is this?)
Mapping: Get Nodes checked at "string"
And at last an example log entry of the tRestClient:
ID: 2
Response-Code: 200
Encoding: UTF-8
Content-Type: application/json; charset=utf-8
Headers: {connection=, Content-Length=, content-type=, Date=, Keep-Alive=, Server=, X-Powered-By=}
Payload: {"vendor":{"uuid":"1234", ...

Thanks in advance
Labels (4)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi
It is the body column or the string column that contains the string json? If body column, it is a Document type, link tRestClient to a tXMLMap to extract the string Json, and then link the output to a tExtractJSONFields to extract the value from the string Json, the job looks like:
tRestClient--main--tXMLMap--main--tExtractJSONFields--tLogRow
If the string column contains the string json, link tRestClient to tExtractJSONFields and extract the value, the job looks like:
tRestClient--main--tExtractJSONFields--tLogRow
please see my screenshots to know about the settings of tExtractJSONFields for extracting the value.
Shong
0683p000009MEJH.png

View solution in original post

4 Replies
Anonymous
Not applicable
Author

Hi
It is the body column or the string column that contains the string json? If body column, it is a Document type, link tRestClient to a tXMLMap to extract the string Json, and then link the output to a tExtractJSONFields to extract the value from the string Json, the job looks like:
tRestClient--main--tXMLMap--main--tExtractJSONFields--tLogRow
If the string column contains the string json, link tRestClient to tExtractJSONFields and extract the value, the job looks like:
tRestClient--main--tExtractJSONFields--tLogRow
please see my screenshots to know about the settings of tExtractJSONFields for extracting the value.
Shong
0683p000009MEJH.png
Anonymous
Not applicable
Author

Hi,
thanks, that helped!
_AnonymousUser
Specialist III
Specialist III

Hi,
How to fetch the particuler string handling like below
example 
laks:ram,chandran
result:
ram,chandran
_AnonymousUser
Specialist III
Specialist III

Hi,
How to fetch the particuler string handling like below
example 
data from source cloumn A = laks:ram,chandran
result:
i want to have the values in  column A as below ( i tried using out1.A.substring(out1.A.indexOf(":")+1) but A cloumn data getting scattered  into two columns ( A =ram , B = chandran)  but i want it in A column only like below
A = ram,chandran