Examples
All examples on this page are fully interactive! You can modify both the kJQ filter and the JSON data in real-time to see how different filters work.
Changes update instantly as you type, making it easy to experiment and learn kJQ syntax.
Basic filters
Truthy filter
Check if a field exists and is not null:
Scalar comparator filter
Compare values against numbers:
Selector comparator filter
Compare two fields within the same record:
Function filters
Contains function
Check if a string or array contains specific text:
Regex tests
Test if a field matches a regular expression:
Negated filter
Use not
to invert filter results:
Advanced selectors
Quoted selectors
Handle special characters in field names:
Multiple filters
AND operations
All conditions must be true:
OR operations
Any condition can be true:
Mixed logic with precedence
Complex filters with explicit precedence using parentheses:
Date filtering
Basic date comparison
Convert dates to ISO-8601 format for comparison:
Unix timestamp comparison
Unix timestamps work directly with date manipulation:
Date range filtering
Check if a date falls within a specific range:
Record size filtering
Total record size
Filter by total serialized record size:
Key and value sizes
Filter by individual component sizes:
Null key check
Find records with null keys:
Tombstone records
Find all records that are Kafka tombstone records:
String slicing
Basic string slicing
Extract and compare substrings:
String slicing from end
Use negative indices to slice from the end:
Complex nested string slicing
Extract substrings from nested objects:
Alternative and arithmetic operations
Alternative operator
Use fallback values with the //
operator:
Basic arithmetic
Perform calculations on numeric fields:
Success rate calculation
Calculate ratios using division:
Complex arithmetic with alternatives
Combine arithmetic with fallback values:
Try your own
Use this playground to experiment with your own kJQ filters: