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: 
welshsteve
Creator
Creator

Extracting value from API call

Hi.

I am struggling to extract a specific value from an API response.

This is the response from the API:

-----------------

{

  "choice_category": "",

  "datasource": "",

  "default": "Administration",

  "default_category": "",

  "filter": [],

  "flag": [

    "ff_lock_publish_overwrite",

    "ff_required",

    "ff_searchable",

    "ff_conditional"

  ],

  "format": "None",

  "group": "entity_note",

  "key_id": 5075,

  "key_name": "type",

  "locales": [],

  "maxlengthlimit": 40,

  "ops": [

    "op_equal",

    "op_not_equal",

    "op_greater",

    "op_greater_or_equal",

    "op_less",

    "op_less_or_equal",

    "op_contain",

    "op_not_contain",

    "op_blank",

    "op_not_blank",

    "op_is_in_list",

    "op_is_not_in_list"

  ],

  "override": 1,

  "title": "Note|Type",

  "type": "ft_choice",

  "unit": null,

  "verifier": "",

  "choices": [

    [

      "Administration",

      "Administration"

    ],

    [

      "Call",

      "Call"

    ],

    [

      "Email",

      "Email"

    ],

    [

      "General",

      "General"

    ],

    [

      "Letter",

      "Letter"

    ],

    [

      "Meeting",

      "Meeting"

    ],

    [

      "Other",

      "Other"

    ],

    [

      "Data Migration",

      "Data Migration"

    ]

  ]

}

 

--------

I wish to extract the "default" value, which is "Administration" (highlighted in bold above).

I thought I'd set it up correctly, but I am getting NULL back.

This is my job.

0695b00000htbUyAAI.png 

I thought giving the Loop Jsonpath query as it is above would be correct given the value I wish to extract from the response is the value for "default".

Thanks in advance.

Steve

Labels (2)
1 Solution

Accepted Solutions
Lord-Vader
Contributor III
Contributor III

If im not wrong its because the loop is set to loop through default looking for a key. but you have the key in the root. so just leave it as the root "$" and in the json query set "default". look at my screenshot. i got the administration.

0695b00000htbZyAAI.png0695b00000htbaNAAQ.png

Hope this helps.

Vader out 💪.

View solution in original post

2 Replies
Lord-Vader
Contributor III
Contributor III

If im not wrong its because the loop is set to loop through default looking for a key. but you have the key in the root. so just leave it as the root "$" and in the json query set "default". look at my screenshot. i got the administration.

0695b00000htbZyAAI.png0695b00000htbaNAAQ.png

Hope this helps.

Vader out 💪.

welshsteve
Creator
Creator
Author

Brilliant. Thank you @kevin cork​, that's worked.