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 details)

Uploaded Source

File details

Details for the file codedjson-1.1.0.tar.gz.

File metadata

  • Download URL: codedjson-1.1.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.5

File hashes

Hashes for codedjson-1.1.0.tar.gz
Algorithm Hash digest
SHA256 f2df5f51d63bf5ef50300ac607577242e53ff42d21ca988b9716875a118f283a
MD5 4fb9b9863d2383fabde344b0f39472bd
BLAKE2b-256 c1ca6fe3c495f1afb3c5d3419f852d8d1f2a9c68cc0203009d037316115138d2

See more details on using hashes here.

Provenance

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