
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
A wrapper to JSON parsers allowing comments, multiline strings and trailing commas
A wrapper to JSON parsers allowing comments, multiline strings and trailing commas
JSON Comment allows to parse JSON files or strings with:
This package works with any JSON parser which supports:
load(fp, ...)
to parse filesloads(s, ...)
to parse stringsby adding a preprocessor to these calls.
#
, ;
and //
are for single line comments/*
and */
enclose multiline commentsInline comments are not supported
Any string can be multiline, even object keys.
"""
, like in python\\n
loadf(path, *args, default = None, **kwargs)
Opens a JSON file with comments. Allows a default value if loading or parsing fails
dumpf(json_obj, path, *args, indent=4, **kwargs)
Saves a JSON file with indentation
pip install jsoncomment
OR
python setup.py install
from jsoncomment import JsonComment
string = "[]"
json = JsonComment()
json_obj = json.loads(string)
Added in the /examples directory
#
, ;
, //
and /*
may be preceded only by whitespaces or tabs on the same line*/
may be followed only by whitespaces or tabs on the same lineSource code available with MIT license on Bitbucket.
Added in top level __init__.py
API is split in:
* `User Interface` for common use
* `Developer Interface` exposing some internals that could be useful
For each item ( function or class ), there are 2 blocks of comments, above and below item definition:
* The top describes the return values
* The bottom describes the item and call variables
If call variables have defaults or use duck typing, every allowed value is described
Example:
# return_value
# description
from .some_module import SomeClass
# SomeClass description
# (
# variable_1,
# description
# variable_2 = something,
# description
# = Default
# description of default value ( something )
# = something_2
# description of alternate form ( duck typing )
# )
describes return_value = SomeClass(variable_1, variable_2 = current_value)
Gaspare Iengo @ email
FAQs
A wrapper to JSON parsers allowing comments, multiline strings and trailing commas
We found that jsoncomment demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.