Skip to main content
CommunityTeamEnterprise

Examples

Interactive 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:

JSON Input
Filter Result

Scalar comparator filter

Compare values against numbers:

JSON Input
Filter Result

Selector comparator filter

Compare two fields within the same record:

JSON Input
Filter Result

Function filters

Contains function

Check if a string or array contains specific text:

JSON Input
Filter Result

Regex tests

Test if a field matches a regular expression:

JSON Input
Filter Result

Negated filter

Use not to invert filter results:

JSON Input
Filter Result

Advanced selectors

Quoted selectors

Handle special characters in field names:

JSON Input
Filter Result

Multiple filters

AND operations

All conditions must be true:

JSON Input
Filter Result

OR operations

Any condition can be true:

JSON Input
Filter Result

Mixed logic with precedence

Complex filters with explicit precedence using parentheses:

JSON Input
Filter Result

Date filtering

Basic date comparison

Convert dates to ISO-8601 format for comparison:

JSON Input
Filter Result

Unix timestamp comparison

Unix timestamps work directly with date manipulation:

JSON Input
Filter Result

Date range filtering

Check if a date falls within a specific range:

JSON Input
Filter Result

Record size filtering

Total record size

Filter by total serialized record size:

JSON Input
Filter Result

Key and value sizes

Filter by individual component sizes:

JSON Input
Filter Result

Null key check

Find records with null keys:

JSON Input
Filter Result

Tombstone records

Find all records that are Kafka tombstone records:

JSON Input
Filter Result

String slicing

Basic string slicing

Extract and compare substrings:

JSON Input
Filter Result

String slicing from end

Use negative indices to slice from the end:

JSON Input
Filter Result

Complex nested string slicing

Extract substrings from nested objects:

JSON Input
Filter Result

Alternative and arithmetic operations

Alternative operator

Use fallback values with the // operator:

JSON Input
Filter Result

Basic arithmetic

Perform calculations on numeric fields:

JSON Input
Filter Result

Success rate calculation

Calculate ratios using division:

JSON Input
Filter Result

Complex arithmetic with alternatives

Combine arithmetic with fallback values:

JSON Input
Filter Result

Try your own

Use this playground to experiment with your own kJQ filters:

JSON Input
Filter Result