Property Flattener

Last updated:

Note: With the release of HogQL, you can access nested properties without the need for this app. We have disabled new installations of it, but you can still use it if you have it installed.

This app flattens nested properties in PostHog events, making it easier to access them through filters if needed.

This is useful if, for example, you're an online retailer and have purchase events with the following property structure:

{
"event": "purchase",
"properties": {
"product": {
"name": "AZ12 shoes",
"type": "footwear",
"size": {
"number": 12,
"gender": "M"
}
}
}
}

This app will keep the nested properties unchanged, but also add any nested properties at the first depth, like so:

{
"event": "purchase",
"properties": {
"product": {
"name": "AZ12 shoes",
"type": "footwear",
"size": {
"number": 12,
"gender": "M"
}
},
"product__name": "AZ12 shoes",
"product__type": "footwear",
"product__size__number": 12,
"product__size__gender": "M"
}
}

As such, you can now filter your purchase events based on productsizenumber for example.

Requirements

The Property Flattener requires either PostHog Cloud, or a self-hosted PostHog instance running version 1.30.0 or later.

Not running 1.30.0? Find out how to update your self-hosted PostHog deployment!

Installation

  1. Visit the 'Apps' page in your instance of PostHog.
  2. Search for 'Property Flattener' and select the app, press Install.
  3. Follow the on-screen steps to configure the app.

Separating nested properties

The default separator for nested properties is two subsequent underscores (__), but you can also change this to:

  • .
  • >
  • /

When picking your separator, make sure it will not clash with your property naming patterns! There be dragons.

Configuration

OptionDescription
Select a separator format for accessing your nested properties
Type: choice
Required: True
For example, to access the value of 'b' in a: { b: 1 } with separator '', you can do 'ab'

FAQ

Is the source code for this app available?

PostHog is open-source and so are all apps on the platform. The source code for the Property Flattener is available on GitHub.

Who created this app?

We'd like to thank PostHog team members Yakko Majuri, Tim Glaser and Marius Andra and community member Chasovskiy for creating the Property Flattener.

Who maintains this app?

This app is maintained by PostHog, but we have stopped actively developing it with the release of HogQL. If you have issues with the app not functioning as intended, please let us know!

What if I have feedback on this app?

We love feature requests and feedback! Please tell us what you think! to tell us what you think.

Or, if you see the feedback widget enabled, use that!

What if my question isn't answered above?

We love answering questions. Ask us anything via our community forum, or drop us a message.

Questions?

Was this page useful?

Next article

Schema Enforcer

The app enables you to enforce a schema on events in PostHog as they are ingested. It does this by preventing ingestion if the event: Is missing a required property Has a property with the wrong type Is not included in the file and onlyIngestEventsFromFile is true It also: Removes all other properties from an event except selected ones if acceptOnlySchemaProps is true Configuration is done via a JSON file uploaded as an attachment Requirements The Schema Enforcer app requires either PostHog…

Read next article