Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhancement: implement generic flattening #1017

Merged
merged 2 commits into from
Dec 6, 2024

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",
	}
]

`

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
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
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.

None yet

2 participants