codedjson


Namecodedjson JSON
Version 2.0.0 PyPI version JSON
download
home_pagehttps://github.com/SubhenduShekhar/cjson
SummaryCJSON is a data file format(inspired from JSON), but supports logical expressions too. Having extended language support to NodeJS, Python and Java, users has experienced data reusability. For features and examples, please refer to official github readme
upload_time2023-12-29 06:04:10
maintainer
docs_urlNone
authorShubhendu Shekhar Gupta
requires_python
license
keywords coded json cjson codedjson coded-json
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center">
    <img src="https://github.com/SubhenduShekhar/cjson/blob/main/docs/logo.png?raw=true" width="200" alt="CJSON Logo"/>
    <h2>Coded Javascript Object Notation</h2><br/>
    <h2>For Python</h2><br/>
    <h3>
        CJSON is a data file format(inspired from JSON), but supports logical expressions too. Having extended language support to NodeJS, Python and Java, users has experienced data reusability. For features and examples, please refer to this documentation as base document.
    </h3>
    <br/>
    <div>
        <img src="https://img.shields.io/badge/Python-pypi-purple" alt="Python Tag">
    </div>
    <div>
        <img src="https://github.com/SubhenduShekhar/cjson/actions/workflows/python-tests.yml/badge.svg" alt="Test Status"/>
    </div>
</div>

<br/><br/>

<br/>

## Installation

`pip install codedjson`

## Examples

### Importing a JSON file in CJSON file

#### file.cjson

```
{
    "source": $import "path/to/source.json",
    "target": {
        "fruit": "Apple",
        "size": "Large",
        "color": "Red"
    }
}
```

#### Code

```
    from cjson import Cjson
    cjson = Cjson(file/path/to/file.cjson);
    var b = cjson.deserialize();
```

#### Output

```
{
    "source": {
        // source.json content
    },
    "target": {
        "fruit": "Apple",
        "size": "Large",
        "color": "Red"
    }
}
```

### Calling relative keys using JPATH

Below example shows `color` variable is calling data from `fruit` variable

#### file.cjson
```
{
    "target": {
        "fruit": "Orange",
        "size": "Medium",
        "color": $.target.fruit
    }
}
```

#### Code

```
    from cjson import Cjson
    cjson = Cjson(file/path/to/file.cjson);
    var b = cjson.deserialize();
```

#### Output

```
{
    "target": {
        "fruit": "Orange",
        "size": "Medium",
        "color": "Orange"
    }
}
```

### Dynamic variable injection

#### file.cjson

```
{
    "target": {
        "types": "asd",
        "fruit": <fruit>,
        "quantity": <quantity>,
    },
    "jsonInjection": <jsonTypeData>
}
```

#### Code

```
    cjson = Cjson(variable_injection)

        injec_data = {
            "fruit": "apple",
            "quantity": 1,
            "jsonTypeData": {
                "secondaryData": {
                    "type": "fruit",
                    "seeds": "yes"
                }
            }
        }

    data = cjson.inject(injecting_obj=injec_data)
```

#### Output

```
{
    "target": {
        "types": "asd",
        "fruit": "apple,
        "quantity": 1,
    },
    "jsonInjection": {
        "secondaryData": {
            "type": "fruit",
            "seeds": "yes"
        }
    }
}
```

### Single/ Multiple line comments


For single line comments, use `//`

For multi line comments, use like below:
```
// This is first line comment
// This is the second one

{
    "name": "Amrut" // This is not allowed
}
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/SubhenduShekhar/cjson",
    "name": "codedjson",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "coded,json,cjson,codedjson,coded-json",
    "author": "Shubhendu Shekhar Gupta",
    "author_email": "subhendushekhargupta@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/90/9a/f9619d10f23868c5cdf87eb8388c7b1362b52772f28c4445c0baf1a48e7b/codedjson-2.0.0.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\r\n    <img src=\"https://github.com/SubhenduShekhar/cjson/blob/main/docs/logo.png?raw=true\" width=\"200\" alt=\"CJSON Logo\"/>\r\n    <h2>Coded Javascript Object Notation</h2><br/>\r\n    <h2>For Python</h2><br/>\r\n    <h3>\r\n        CJSON is a data file format(inspired from JSON), but supports logical expressions too. Having extended language support to NodeJS, Python and Java, users has experienced data reusability. For features and examples, please refer to this documentation as base document.\r\n    </h3>\r\n    <br/>\r\n    <div>\r\n        <img src=\"https://img.shields.io/badge/Python-pypi-purple\" alt=\"Python Tag\">\r\n    </div>\r\n    <div>\r\n        <img src=\"https://github.com/SubhenduShekhar/cjson/actions/workflows/python-tests.yml/badge.svg\" alt=\"Test Status\"/>\r\n    </div>\r\n</div>\r\n\r\n<br/><br/>\r\n\r\n<br/>\r\n\r\n## Installation\r\n\r\n`pip install codedjson`\r\n\r\n## Examples\r\n\r\n### Importing a JSON file in CJSON file\r\n\r\n#### file.cjson\r\n\r\n```\r\n{\r\n    \"source\": $import \"path/to/source.json\",\r\n    \"target\": {\r\n        \"fruit\": \"Apple\",\r\n        \"size\": \"Large\",\r\n        \"color\": \"Red\"\r\n    }\r\n}\r\n```\r\n\r\n#### Code\r\n\r\n```\r\n    from cjson import Cjson\r\n    cjson = Cjson(file/path/to/file.cjson);\r\n    var b = cjson.deserialize();\r\n```\r\n\r\n#### Output\r\n\r\n```\r\n{\r\n    \"source\": {\r\n        // source.json content\r\n    },\r\n    \"target\": {\r\n        \"fruit\": \"Apple\",\r\n        \"size\": \"Large\",\r\n        \"color\": \"Red\"\r\n    }\r\n}\r\n```\r\n\r\n### Calling relative keys using JPATH\r\n\r\nBelow example shows `color` variable is calling data from `fruit` variable\r\n\r\n#### file.cjson\r\n```\r\n{\r\n    \"target\": {\r\n        \"fruit\": \"Orange\",\r\n        \"size\": \"Medium\",\r\n        \"color\": $.target.fruit\r\n    }\r\n}\r\n```\r\n\r\n#### Code\r\n\r\n```\r\n    from cjson import Cjson\r\n    cjson = Cjson(file/path/to/file.cjson);\r\n    var b = cjson.deserialize();\r\n```\r\n\r\n#### Output\r\n\r\n```\r\n{\r\n    \"target\": {\r\n        \"fruit\": \"Orange\",\r\n        \"size\": \"Medium\",\r\n        \"color\": \"Orange\"\r\n    }\r\n}\r\n```\r\n\r\n### Dynamic variable injection\r\n\r\n#### file.cjson\r\n\r\n```\r\n{\r\n    \"target\": {\r\n        \"types\": \"asd\",\r\n        \"fruit\": <fruit>,\r\n        \"quantity\": <quantity>,\r\n    },\r\n    \"jsonInjection\": <jsonTypeData>\r\n}\r\n```\r\n\r\n#### Code\r\n\r\n```\r\n    cjson = Cjson(variable_injection)\r\n\r\n        injec_data = {\r\n            \"fruit\": \"apple\",\r\n            \"quantity\": 1,\r\n            \"jsonTypeData\": {\r\n                \"secondaryData\": {\r\n                    \"type\": \"fruit\",\r\n                    \"seeds\": \"yes\"\r\n                }\r\n            }\r\n        }\r\n\r\n    data = cjson.inject(injecting_obj=injec_data)\r\n```\r\n\r\n#### Output\r\n\r\n```\r\n{\r\n    \"target\": {\r\n        \"types\": \"asd\",\r\n        \"fruit\": \"apple,\r\n        \"quantity\": 1,\r\n    },\r\n    \"jsonInjection\": {\r\n        \"secondaryData\": {\r\n            \"type\": \"fruit\",\r\n            \"seeds\": \"yes\"\r\n        }\r\n    }\r\n}\r\n```\r\n\r\n### Single/ Multiple line comments\r\n\r\n\r\nFor single line comments, use `//`\r\n\r\nFor multi line comments, use like below:\r\n```\r\n// This is first line comment\r\n// This is the second one\r\n\r\n{\r\n    \"name\": \"Amrut\" // This is not allowed\r\n}\r\n```\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "CJSON is a data file format(inspired from JSON), but supports logical expressions too. Having extended language support to NodeJS, Python and Java, users has experienced data reusability. For features and examples, please refer to official github readme",
    "version": "2.0.0",
    "project_urls": {
        "Homepage": "https://github.com/SubhenduShekhar/cjson"
    },
    "split_keywords": [
        "coded",
        "json",
        "cjson",
        "codedjson",
        "coded-json"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "909af9619d10f23868c5cdf87eb8388c7b1362b52772f28c4445c0baf1a48e7b",
                "md5": "75ea23ef0ad8363b8e1b603fe7fcf2e4",
                "sha256": "698aa0bd2879b95f6beab6eebba50b07e486e930f28787d974cd36cdb79b17be"
            },
            "downloads": -1,
            "filename": "codedjson-2.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "75ea23ef0ad8363b8e1b603fe7fcf2e4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 8231,
            "upload_time": "2023-12-29T06:04:10",
            "upload_time_iso_8601": "2023-12-29T06:04:10.195520Z",
            "url": "https://files.pythonhosted.org/packages/90/9a/f9619d10f23868c5cdf87eb8388c7b1362b52772f28c4445c0baf1a48e7b/codedjson-2.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-29 06:04:10",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "SubhenduShekhar",
    "github_project": "cjson",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "codedjson"
}
        
Elapsed time: 0.16397s