H2 · Response Validation: statusCode: `jsonPath()` is like a **map coordinate** for GOING to a specific field in a JSON body — saying `"title"` is enough, you do NOT need to writ
`jsonPath()` is like a **map coordinate** for GOING to a specific field in a JSON body — saying `"title"` is enough, you do NOT need to write manual `JSONObject` parsing. Hamcrest matchers (`hasItem`, `equalTo`, `hasSize`) are the sentences that COMPARE this value. The Java equivalent is manually converting to a `Map ` with `ObjectMapper` and calling nested `get()`s — it works but is FRAGILE (a misspelled field name is NOT caught at compile time). `jsonPath()` reduces this to ONE line. **For a deep jsonPath/Hamcrest guide → see the `/rest-assured` page.**
🎬 From Manual Parsing to a One-Line Coordinate
Manual Map/get() chain
compare with equalTo(...)
Manual approach: convert to a Map with ObjectMapper, write nested get("bugs").get(0).get("title") — fragile.
`jsonPath("title")` reaches the same field in ONE readable-coordinate line.
Hamcrest `equalTo(...)`/`hasItem(...)` compares the value — a readable verification sentence completes.
The Order for Verifying with jsonPath
Identify the field's path…
Note the field name (title, severity) in the JSON body.
Pick the right Hamcrest matcher, like equalTo, hasItem, oneOf.
Bind with .body(...)…
Complete the verification by adding .body("field", matcher) to the then() chain.
Order the process for verifying a field with jsonPath.