https://github.com/pushshift/json-flatten
This code shows how to flatten nested keys which can help convert a nest JSON object into CSV, etc.
https://github.com/pushshift/json-flatten
Last synced: 10 months ago
JSON representation
This code shows how to flatten nested keys which can help convert a nest JSON object into CSV, etc.
- Host: GitHub
- URL: https://github.com/pushshift/json-flatten
- Owner: pushshift
- License: mit
- Created: 2023-10-14T05:01:38.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-14T05:17:21.000Z (over 2 years ago)
- Last Synced: 2025-01-11T20:45:30.953Z (about 1 year ago)
- Language: Python
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
This Python script will flatten a nested JSON object (or Python dict).
If you run it directly, it will load an example Youtube object and flatten the keys.
You can also pipe a JSON object into it and get the flattened keys that way.
There are two parameters that can be used to modify the behavior of the flatten method.
The "sep" parameter is the separation character used between each key and child key. This
defaults to ".".
The "include_values" parameter is a boolean and if set to True will also include the values
of each of the flattened keys.