JSONPath for data redaction in Rewst

Jinja versus JSONPath with complex nested data
Example JSON
Example Jinia list comprehension
Example JSONPath
When to use JSONPath versus comprehension
Scenario
Use JSONPath
Use Comprehension
Example combo use of JSONPath and comprehension
Further examples
Examples for security redaction
Goal
Recommended JSONPath
Simple mode - extended=False, default
extended=False, defaultExtended mode - extended=True
extended=TrueJSONPath summary table
Capability
Simple Mode
Extended Mode
Notes
Usage tips
Example API response CTX.Extracted_Data
Visual path examples with Jinja and results
Rewst JSONPath visual path examples
All usernames
First user’s username - Alice
Second user - Bob
First two users - slice example
All roles - flattened
Service names
Endpoint URLs
Tokens expiring soon - extended=True
extended=TrueAuthorization header exists - extended=True
extended=TrueDocument IDs - data-service
All tags - flattened
On-call team member names
On-call members only - extended=True
extended=True Extract all timestamps anywhere in the structure using $[*]..timestamp style
$[*]..timestamp styleJSONPath
Example result
Extract timestamps only for login activities using $[*]..activity[?(@.event=="login")].timestamp pattern
login activities using $[*]..activity[?(@.event=="login")].timestamp patternJSONPath
Example result
JSONPath recap in Rewst
Concept
Description
Example
Formatting conventions
Type
Example
Rewst Jinja comprehension equivalents for JSONPath
All usernames
First user’s username - Alice
Second user - Bob object
First two users - Slice example
All roles - flattened
Service names
Endpoint URLs
Tokens expiring soon - less than 3000
Document IDs - data-service
All tags - flattened
On-call team member names
On-call only - filter
On-call contact methods - flattened
Last updated
Was this helpful?

