Skip to content

Latest commit

 

History

History
26 lines (20 loc) · 828 Bytes

find_and_extract_object.md

File metadata and controls

26 lines (20 loc) · 828 Bytes

Find and Extract Objects

When you call a REST API, you get a JSON response. You can use jq to extract the data you need from the JSON response.

http https://jsonplaceholder.typicode.com/posts/1/comments | jq '.[] | select(.email == "Hayden@althea.biz")'
{
  "postId": 1,
  "id": 5,
  "name": "vero eaque aliquid doloribus et culpa",
  "email": "Hayden@althea.biz",
  "body": "harum non quasi et ratione\ntempore iure ex voluptates in ratione\nharum architecto fugit inventore cupiditate\nvoluptates magni quo et"
}

To get the whole set of objects, you can use the following:

http https://jsonplaceholder.typicode.com/posts/1/comments

Resources and References