Skip to main content
Quick navigation

Formatting Data (JQ)

You can format your Kafka messages so long as they have a JSON-compatible representation (Including Avro and Proto with Schema Registry). Conduktor uses jq to create projections over your Kafka data.

This can be advantageous if you wish to view only select fields in larger messages.

  • From within the consumer view, select a message and toggle the JSON view
  • Ensure jq is enabled, and add your filter to the input

Format Data

Simple projections

Given a sample message like the following one:

{
"foo": {
"bar": "value"
}
}

You can use the following JQ filter on your message:

.foo
// will output
{
"bar": "value"
}

.foo.bar
// will output
"value"

Advanced projections

Other useful examples include:

// Subset
.data.authorizationInfo

// New JSON from elements
{ id: .source, val: .specversion }

// Functions
.data.authenticationInfo.principal | split(":")[1]

// Concat
.data.authenticationInfo.principal + " granted " + .data.authorizationInfo.operation

// Filter
[3, 2, 1] | first

Check the JQ Manual for more details.