Kapil
July 12, 2019, 6:09pm
1
How I can extract the single user_id for following JSON response
{“success”:true,“data”:{“104795”:[{“user_id”:“104795”,“user_full_name”:"Kapil ",“count_of_payment_instruction_in_specified_status”:203}],“125965”:[{“user_id”:“125965”,“user_full_name”:“fee clerk”,“count_of_payment_instruction_in_specified_status”:20}],“f25e0508-a413-409a-8f93-5fe8ce8bf031”:[{“user_id”:“f25e0508-a413-409a-8f93-5fe8ce8bf031”,“user_full_name”:“SiteSwitch Fee”,“count_of_payment_instruction_in_specified_status”:24}]}}
I tried following jsonPath and that’s giving me expected value 104795 BUT here I need to use value ‘Kapil’ and I don’t want to use it because that’s also dynamic value
$.data.[?(@.user_full_name == ‘Anish feeclerk’)].user_id
Please can you suggest what’s wrong I am doing here to extract single user_id or all user_ids
Regards
K
For userid of fee clerk
$.data.125965[0].user_id
For userif of Kapil use this
$.data.104795[0].user_id
Kapil
July 13, 2019, 7:21am
3
user id value and the value you mentioned above for child are same and generated dynamically so I don’t think we can use the number before [0] and may need some regular expression
Kapil
July 15, 2019, 7:41am
4
How I can extract the single user_id for following JSON response
{“success”:true,“data”:{“104795”:[{“user_id”:“104795”,“user_full_name”:"Kapil ",“count_of_payment_instruction_in_specified_status”:203}],“125965”:[{“user_id”:“125965”,“user_full_name”:“fee clerk”,“count_of_payment_instruction_in_specified_status”:20}],“f25e0508-a413-409a-8f93-5fe8ce8bf031”:[{“user_id”:“f25e0508-a413-409a-8f93-5fe8ce8bf031”,“user_full_name”:“SiteSwitch Fee”,“count_of_payment_instruction_in_specified_status”:24}]}}
I tried following jsonPath and that’s giving me expected value 104795 BUT here I need to use value ‘Kapil’ and I don’t want to use it because that’s also dynamic value
$.data.[?(@.user_full_name == ‘Anish feeclerk’)].user_id
I would like to extract either value for user id or value for child i.e., 104795 but this value is same for child and it’s element user_id.
Please can you suggest what’s wrong I am doing here to extract single user_id or all user_ids