https://github.com/posthog/flatten-properties-plugin
Flatten event properties to easily access them in filters.
https://github.com/posthog/flatten-properties-plugin
Last synced: 6 months ago
JSON representation
Flatten event properties to easily access them in filters.
- Host: GitHub
- URL: https://github.com/posthog/flatten-properties-plugin
- Owner: PostHog
- License: mit
- Created: 2021-02-19T14:45:20.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2024-09-04T07:16:48.000Z (over 1 year ago)
- Last Synced: 2025-07-17T21:29:43.595Z (6 months ago)
- Language: JavaScript
- Homepage: https://posthog.com/plugins/property-flattener
- Size: 121 KB
- Stars: 3
- Watchers: 1
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Property Flattener Plugin
> [!WARNING]
> This plugin has been deprecated. You can use [HogQL](https://posthog.com/docs/hogql) to access nested properties in PostHog.
Flatten nested properties in PostHog events to easily access them in filters.
## Example
For example, if you're an online retailer, and have `purchase` events with the following property structure:
```json
{
"event": "purchase",
"properties": {
"product": {
"name": "AZ12 shoes",
"type": "footwear",
"size": {
"number": 12,
"gender": "M"
}
}
}
}
```
This plugin will keep the nested properties unchanged, but also add any nested properties at the first depth, like so:
```json
{
"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 `product__size__number` for example.
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.