Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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
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.
Hope this helps.
Vader out 💪.
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.
Hope this helps.
Vader out 💪.
Brilliant. Thank you @kevin cork, that's worked.