Schema Detection

PEEK automatically detects the structure of your JSON payloads without storing raw message data.

How It Works

Every time a message arrives, PEEK extracts the field names and types from the JSON payload. For example, this message:

{
  "temperature": 22.5,
  "humidity": 48,
  "sensor": {
    "model": "DHT22",
    "firmware": "1.2.3"
  }
}

Produces this detected schema:

FieldType
temperaturenumber
humiditynumber
sensor·modelstring
sensor·firmwarestring

Nested objects are flattened using the · (middle dot) separator. Arrays are recorded as the array type without recursing into their contents.

Schema Evolution

As your devices evolve, their payloads may gain new fields. PEEK handles this gracefully — if a message contains all the fields of an existing schema plus new ones, the schema is updated and the new fields are marked as optional.

Note
Schema evolution means you don't end up with a new schema every time a device adds an optional field. PEEK merges compatible schemas automatically.

Discriminator Fields

Many IoT systems send different message types through the same channel. For example, a device might send telemetry, status, and alert messages that all have different structures.

To keep these schemas separate, you can configure a discriminator field on your source. This tells PEEK which field determines the message type. For example, setting the discriminator to messageType means:

{"messageType": "telemetry", "temperature": 22}  -> Telemetry Schema
{"messageType": "status", "battery": 85}        -> Status Schema
{"messageType": "alert", "code": "E001"}        -> Alert Schema

Without a discriminator, these would be merged into one schema with many optional fields. With a discriminator, they remain separate, semantically meaningful schemas.

Group-By Analytics

You can mark any schema field as a group-by field to track fleet-wide distributions. For example, marking sensor·firmware as group-by lets you see how many devices are running each firmware version.

PEEK tracks the latest value of group-by fields per device and displays the distribution as an inline chart on the Messages page.

Viewing Schemas

Navigate to the Messages tab in the dashboard to see all detected schemas. Click on a schema to view its fields, toggle optional flags, enable group-by analytics, and rename it for clarity.