name = JSON Response Capture Examples
description = Demonstrates direct, nested, indexed, defaulted, and dependency-based JSON response captures using JSONPlaceholder.
$ BASE = https://jsonplaceholder.typicode.com
---
Get User
GET {{ BASE }}/users/1
& body.id -> $USER_ID
& body.username -> $USERNAME
& body.address.city -> $CITY
& body.address.geo.lat -> $LATITUDE
& body.company.name -> $COMPANY_NAME
& body.address.country -> $COUNTRY := unknown
^ & status == 200
^ $USER_ID == '1'
^ $USERNAME != ''
^ $CITY != ''
^ $LATITUDE ~= /-?[0-9]+\.[0-9]+/
^ $COMPANY_NAME != ''
^ $COUNTRY == 'unknown'
---
Get User Posts
> requires: Get User
GET {{ BASE }}/posts
? userId = {{ USER_ID }}
& body.[0].id -> $FIRST_POST_ID
& body.[0].title -> $FIRST_POST_TITLE
&[Get User].body.email -> $USER_EMAIL
&[Get User].body.address.zipcode -> $USER_ZIPCODE
^ & status == 200
^ & body.[0].userId == $USER_ID
^ $FIRST_POST_ID != ''
^ $FIRST_POST_TITLE != ''
^ $USER_EMAIL ~= /@/
^ $USER_ZIPCODE != ''