Skip to main content

CSJ Parser for Python

N|package Build Status

Comma Separated JSON (CSJ) is a CSV like file format designed for stream processing where each cell is valid JSON. This makes it very similar to CSV, but without the problems that CSV has.

For more information, please visit [https://kirit.com/Comma%20Separated%20JSON]

Installation

CSJ Parser requires Python 3.5 or later to run. CSJ Parser can be installed using pip:

$ pip install csj-parser

If you want the latest release, you can install from git:

$ pip install git+https://github.com/Proteus-tech/csj-parser.git

Examples

Convert JSON to CSJ

from csj_parser.csj import Csj

json_list = [
    {
        "key1" : "value1",
        "key2" : ["item1", "item2", "item3"],
        "key3" : {"key" : "value"}
    },
    {
        "key1" : 10,
        "key2" : None,
        "key3" : None
    }
]

# This function returns a string of data in CSJ format
def convert_json_to_csj(json_dict):
    csj_string = Csj.from_dicts(json_dict)
    return csj_string
    
convert_json_to_csj(json_list)

Output

"key1","key2","key3"
"value1",["item1","item2","item3"], {"key":"value"}
10,null,null

Convert CSJ to JSON

from csj_parser.csj import Csj

csj_str = '''"key1","key2","key3"\n"value1","value2","value3"\n"value4","value5","value6"\n'''

# This function returns a dictionary of data in JSON format
def convert_csj_to_json(csj_string):
    json_dict = Csj.to_dict(csj_string)
    return json_dict
    
convert_csj_to_json(csj_str)

Output

[{'key1': 'value1', 'key2': 'value2', 'key3': 'value3'},{'key1': 'value4', 'key2': 'value5', 'key3': 'value6'}]

[https://kirit.com/Comma%20Separated%20JSON]: https://kirit.com/Comma%20Separated%20JSON

Metadata

Release files for csj-parser 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for csj-parser 0.0.2
File Size Uploaded Provenance
csj_parser-0.0.2.tar.gz 2.6 kB Without provenance Details

Release files / csj_parser-0.0.2.tar.gz

Download URL csj_parser-0.0.2.tar.gz
Size 2.6 kB
Tags Source
SHA-256 checksum
How to use checksums
5ea26b7ca879ded7937084ae902583ccd891fa7d11599c9d5b2a974baecf53ce
BLAKE2b-256 checksum
How to use checksums
669b956f1ceaecbd1ceb444baa8cacd51abd5894a9a7963b05d1cc14986383f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.13.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

Security for csj-parser 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.2 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page