Skip to main content

Coded JSON files. Save your files with .cjson extension to unlock these features

Project description



Coded Javascript Object Notation


Why static JSON if you can utilize CJSON




NodeJS

Your first CJSON code

  • Create file with .cjson extension
  • Write below code to decode the json:
    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"
    }
}

Features

Import multiple JSON files

You can use $import keyword for importing other JSON files.
You can also import multiple JSON files.

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

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

Calling relative keys using JPATH

You can also refer to other variables using $. followed by jpath.
Please note, the current version is only decoding using top to down approach

Keywords

Keyword Description
$import To import other json file
Comments(Single/ Multi-line) //
$.jpath Refer to a local variable inside JSON

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

codedjson-1.1.0.tar.gz (5.6 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page