Name | meta-json JSON |
Version |
1.0.0
JSON |
| download |
home_page | https://github.com/juangcr/meta_json |
Summary | Extract metadata from a deserialized JSON. |
upload_time | 2024-05-17 17:28:47 |
maintainer | None |
docs_url | None |
author | Juan Cortés |
requires_python | >=3.8 |
license | BSD 3-Clause License Copyright (c) 2023, All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
keywords |
metadata
json
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# meta_json
Given a JSON response as a dictionary, extract the metadata such as its structure and data model.
## Introduction
This package is intended to help with JSON analysis by extracting its metadata and ease the data modeling tasks regularly used in design of databases, data catalogs, data warehouses, APIs, etc.
## Installation
This package is available in PyPI and GitHub. Just run:
```python
pip install meta-json
```
Or clone the repository:
```console
git clone https://github.com/juangcr/meta_json.git
cd meta_json
python setup.py install
```
## Usage
```python
from meta_json import MetaJson
your_json_data_as_dict = {
"name": "John Doe",
"contact": "john_doe@mail.net",
"status": {
"start_date": "1970-01-01",
"active": "true",
"credits": {
"due": 10,
"remaining": 90
}
}
}
meta = MetaJson(your_json_data_as_dict)
meta.types() # Returns every data type available.
```
```console
{
"name": "str",
"contact": "str",
"status": {
"start_date": "datetime",
"active": "str",
"credits": {
"due": "int",
"remaining": "int"
}
}
}
```
Keep in mind that the datetime recognition supports the following patterns:
- YYYY-MM-DD
- YYYY/MM/DD
- DD-MM-YYYY
- DD/MM/YYYY
- MM-DD-YYYY
- MM/DD/YYYY
```python
meta.attributes() # Returns a list with two elements: the grouped main keys
# and the rest of the subkeys alltogether.
```
```console
[
[
"name",
"contact",
"status"
],
[
"start_date",
"active",
"credits",
"due",
"remaining"
]
]
```
```python
meta.layers() # Returns all keys grouped by layer depth.
```
```console
{
"layer_0" :[
"name",
"contact",
"status"
],
"layer_1": [
"start_date",
"active",
"credits"
],
"layer_2": [
"due",
"remaining"
]
]
```
Raw data
{
"_id": null,
"home_page": "https://github.com/juangcr/meta_json",
"name": "meta-json",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "metadata, json",
"author": "Juan Cort\u00e9s",
"author_email": "Juan Cort\u00e9s <juang.cortes@outlook.com>",
"download_url": "https://files.pythonhosted.org/packages/05/03/1739ceb2c9c893d47c0e77ca0a3058f2603b8dd0bed6f56bb95b7a334906/meta_json-1.0.0.tar.gz",
"platform": null,
"description": "# meta_json\n\nGiven a JSON response as a dictionary, extract the metadata such as its structure and data model. \n\n\n## Introduction\n\nThis package is intended to help with JSON analysis by extracting its metadata and ease the data modeling tasks regularly used in design of databases, data catalogs, data warehouses, APIs, etc. \n\n\n## Installation\n\nThis package is available in PyPI and GitHub. Just run:\n\n```python\n pip install meta-json\n```\n\nOr clone the repository:\n\n```console\n git clone https://github.com/juangcr/meta_json.git \n cd meta_json\n python setup.py install\n```\n\n## Usage\n\n```python\n from meta_json import MetaJson\n \n your_json_data_as_dict = {\n \"name\": \"John Doe\",\n \"contact\": \"john_doe@mail.net\",\n \"status\": {\n \"start_date\": \"1970-01-01\",\n \"active\": \"true\",\n \"credits\": {\n \"due\": 10,\n \"remaining\": 90\n }\n }\n }\n\n meta = MetaJson(your_json_data_as_dict)\n \n meta.types() # Returns every data type available.\n```\n\n```console\n {\n \"name\": \"str\",\n \"contact\": \"str\", \n \"status\": {\n \"start_date\": \"datetime\",\n \"active\": \"str\",\n \"credits\": {\n \"due\": \"int\",\n \"remaining\": \"int\"\n }\n }\n }\n```\n\nKeep in mind that the datetime recognition supports the following patterns:\n\n- YYYY-MM-DD\n- YYYY/MM/DD\n- DD-MM-YYYY\n- DD/MM/YYYY\n- MM-DD-YYYY\n- MM/DD/YYYY\n\n```python\n meta.attributes() # Returns a list with two elements: the grouped main keys\n # and the rest of the subkeys alltogether.\n```\n\n```console\n [\n [\n \"name\",\n \"contact\",\n \"status\"\n ],\n [\n \"start_date\",\n \"active\",\n \"credits\",\n \"due\",\n \"remaining\"\n ]\n ]\n```\n\n```python\n meta.layers() # Returns all keys grouped by layer depth.\n```\n\n```console\n {\n \"layer_0\" :[\n \"name\",\n \"contact\",\n \"status\"\n ],\n \"layer_1\": [\n \"start_date\",\n \"active\",\n \"credits\"\n ],\n \"layer_2\": [\n \"due\",\n \"remaining\"\n ]\n ]\n```\n\n",
"bugtrack_url": null,
"license": "BSD 3-Clause License Copyright (c) 2023, All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ",
"summary": "Extract metadata from a deserialized JSON.",
"version": "1.0.0",
"project_urls": {
"Homepage": "https://github.com/juangcr/meta_json",
"Repository": "https://github.com/juangcr/meta_json"
},
"split_keywords": [
"metadata",
" json"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e034d9e2b54bf10813d07a823c41d4d83e0e6dbde7ac816905dd59d3140b7264",
"md5": "b67e231c5daf0ddb32b3d065c256d27a",
"sha256": "f7d0e530033f0e203872ded57b2c0538dc2e8559233186c00189811695e26e74"
},
"downloads": -1,
"filename": "meta_json-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b67e231c5daf0ddb32b3d065c256d27a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 9261,
"upload_time": "2024-05-17T17:28:45",
"upload_time_iso_8601": "2024-05-17T17:28:45.998507Z",
"url": "https://files.pythonhosted.org/packages/e0/34/d9e2b54bf10813d07a823c41d4d83e0e6dbde7ac816905dd59d3140b7264/meta_json-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "05031739ceb2c9c893d47c0e77ca0a3058f2603b8dd0bed6f56bb95b7a334906",
"md5": "d682006bcf3ea199c5500fae27a59bd1",
"sha256": "2294de3d8f4a9659cbc4877a210d07ebb2de4e98e863ed630baf28629076a1be"
},
"downloads": -1,
"filename": "meta_json-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "d682006bcf3ea199c5500fae27a59bd1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 9506,
"upload_time": "2024-05-17T17:28:47",
"upload_time_iso_8601": "2024-05-17T17:28:47.358789Z",
"url": "https://files.pythonhosted.org/packages/05/03/1739ceb2c9c893d47c0e77ca0a3058f2603b8dd0bed6f56bb95b7a334906/meta_json-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-17 17:28:47",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "juangcr",
"github_project": "meta_json",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "meta-json"
}