Skip to content
Advertisement

Json response data extraction using linux command

Below is the json response of an api endpoint, I wanted to get the id value of specific name in the below array of json response.

JavaScript

eg: I wanted to get id value(10002) of name test3, with the help of name key. Using jq I’m able to select the name key, but I’m not to find a way to get previous key value(id) using name key! My requirement is to get id value by inputting the corresponding name value.

Advertisement

Answer

Try

JavaScript
JavaScript

Demo

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement