JSONpath in Python Tasks
ο»ΏThis topic contains JSONpath examples.
Examples
See the following JSON document. It shows how JSONpath expressions can be added to it.
You can form expressions to suit your requirement using the supported JSONpath syntax and filters.
Expression | Result |
|---|---|
$ | Entire object |
$.json_response | Entire json_response object |
$.json_response.entities[0] | First entity |
$.['json_response']['entities'][0] | First entity |
$.json_response.entities[0,2] | First and third entity |
$.json_response.entities[:2] | First two entities |
$.json_response.entities[-2:] | Last two entities |
$.json_response.entities[*].name | The name of all the entities |
$..id | All the ids |
$.json_response.entities[?(@.count > 6)] | All entities with count greater than 6 |
$..entities[?(@.type == "InternetDomainName")] | All entities with type InternetDomainName |