Skip to content

Conversation

@nikhilsinhaparseable
Copy link
Contributor

helps to flatten the nested json
such that all list type fields gets converted to primitive type hence spliting the repeating array to multiple rows

eg.
[ { "id": 1, "name": "John Doe", "addresses": [ { "street": "123 Main St", "city": "Springfield", "state": "IL", "zip": "62701" }, { "street": "456 Elm St", "city": "Springfield", "state": "IL", "zip": "62702" } ] } ]

gets coverted to below
`
[
{
"id": 1,
"name": "John Doe",
"addresses_street": "123 Main St",
"addresses_city": "Springfield",
"addresses_state": "IL",
"addresses_zip": "62701",

	},
	{
		"id": 1,
        "name": "John Doe",
		"addresses_street": "456 Elm St",
		"addresses_city": "Springfield",
		"addresses_state": "IL",
		"addresses_zip": "62702",
	}
]

`

helps to flatten the nested json
such that all list type fields gets converted to primitive type
hence spliting the repeating array to multiple rows

eg.
`[
        {
            "id": 1,
            "name": "John Doe",
            "addresses": [
                {
                    "street": "123 Main St",
                    "city": "Springfield",
                    "state": "IL",
                    "zip": "62701"
                },
                {
                    "street": "456 Elm St",
                    "city": "Springfield",
                    "state": "IL",
                    "zip": "62702"
                }
            ]
        }
    ]
`

gets coverted to below
`
[
		{
			"id": 1,
            "name": "John Doe",
			"addresses_street": "123 Main St",
			"addresses_city": "Springfield",
			"addresses_state": "IL",
			"addresses_zip": "62701",

		},
		{
			"id": 1,
            "name": "John Doe",
			"addresses_street": "456 Elm St",
			"addresses_city": "Springfield",
			"addresses_state": "IL",
			"addresses_zip": "62702",
		}
	]
`
@nitisht nitisht merged commit 935ee79 into parseablehq:main Dec 6, 2024
8 checks passed
@nikhilsinhaparseable nikhilsinhaparseable deleted the generic-flattening branch July 12, 2025 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants