{"id":22543380,"url":"https://github.com/gr0vity-dev/json-relational","last_synced_at":"2025-04-14T23:26:04.121Z","repository":{"id":210987311,"uuid":"727750501","full_name":"gr0vity-dev/json-relational","owner":"gr0vity-dev","description":"converting complex, nested JSON data into a flat, relational format","archived":false,"fork":false,"pushed_at":"2024-02-07T09:37:42.000Z","size":14,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T18:47:54.082Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gr0vity-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-05T13:56:47.000Z","updated_at":"2025-02-01T08:52:14.000Z","dependencies_parsed_at":"2025-02-23T01:44:57.587Z","dependency_job_id":"5e438c4a-fff6-4e12-824e-30fd6948bc54","html_url":"https://github.com/gr0vity-dev/json-relational","commit_stats":null,"previous_names":["gr0vity-dev/json-relational"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gr0vity-dev%2Fjson-relational","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gr0vity-dev%2Fjson-relational/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gr0vity-dev%2Fjson-relational/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gr0vity-dev%2Fjson-relational/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gr0vity-dev","download_url":"https://codeload.github.com/gr0vity-dev/json-relational/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248976756,"owners_count":21192465,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-07T13:17:17.763Z","updated_at":"2025-04-14T23:26:04.102Z","avatar_url":"https://github.com/gr0vity-dev.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# json_relational: Transforming Nested JSON to Relational Format\n\n`json_relational` is a small Python package for converting complex, nested JSON data into a flat, relational format. This transformation makes it significantly easier to work with JSON data in contexts where relational databases are more suitable, such as SQL databases. The package is designed to be dynamic and flexible, accommodating various levels of nested structures and converting them into a format that can be easily mapped to SQL tables.\n\n## Features\n\n- **Dynamic Nesting Handling**: Effortlessly manages various levels of nested JSON data.\n- **SQL Table Ready**: Transforms JSON into a format that is easily convertible to SQL tables.\n- **Customizable Depth Control**: Set the maximum depth for flattening nested structures.\n- **Key Mapping Support**: Allows for the remapping of keys to desired names in the output.\n\n## Installation\n\nTo install `json_relational`, clone the repository from GitHub and install it using pip:\n\n```bash\ngit clone https://github.com/gr0vity-dev/json-relational.git\ncd json_relational\npip install .\n```\n\n## Usage\n\nHere's a simple example to demonstrate how `json_relational` can be used to transform nested JSON data into a relational format:\n\n```python\nfrom json_relational import JsonRelational\nimport json\n\n# Example JSON data\njson_data = {\n    \"type\": \"employee\",\n    \"id\": 123,\n    \"data\": {\n        \"department\": \"sales\",\n        \"manager\": \"Bob\"\n    }\n}\n\n# Create an instance of JsonRelational\njr = JsonRelational()\n\n# Flatten the JSON data\nflattened_data = jr.flatten_json(json_data)\n\nprint(json.dumps(flattened_data, indent=4))\n\n```\n\n### Output:\n\nThe output will be a dictionary containing flattened data, along with mappings and accumulated children, ready to be transformed into SQL tables.\n\n```json\n{\n    \"log\": [\n        {\n            \"sql_id\": 1,\n            \"type\": \"employee\",\n            \"id\": 123\n        }\n    ],\n    \"data\": [\n        {\n            \"sql_id\": 1,\n            \"department\": \"sales\",\n            \"manager\": \"Bob\"\n        }\n    ],\n    \"mappings\": [\n        {\n            \"main_type\": \"log\",\n            \"main_sql_id\": 1,\n            \"link_type\": \"data\",\n            \"link_sql_id\": 1\n        }\n    ]\n}\n```\n\n## Contributing\n\nContributions, issues, and feature requests are welcome! Feel free to check [issues page](https://github.com/gr0vity-dev/json-relational/issues).\n\n## License\n\nDistributed under the MIT License. See `LICENSE` for more information.\n\n---\n\n`json_relational` offers an innovative solution for managing and transforming JSON data into a relational structure, making it an invaluable tool for database management, data analysis, and software development involving complex JSON data structures.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgr0vity-dev%2Fjson-relational","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgr0vity-dev%2Fjson-relational","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgr0vity-dev%2Fjson-relational/lists"}