Registry / serialization / jsoncomment

jsoncomment

JSON →
library0.4.2pypypi✓ verified 85d ago

A wrapper to JSON parsers allowing comments, multiline strings and trailing commas. Current version 0.4.2, supports Python >=3.3. Suitable for config files with human-friendly JSON extensions.

pip install jsoncomment
INSTALL
IMPORT
SIG · JSONCOMMENT
J
jsoncomment
serializationpythonv0.4.2
Install
1.6s avg
Import
30ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.4.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.030s · 18.3MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.030s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

JsonComment
from jsoncomment import JsonComment
import jsoncomment
JsonComment is the class; importing the module directly is not wrong but you need the class for usage.

Parse a JSON string with C-style comments.

from jsoncomment import JsonComment json_str = ''' { "name": "test", /* comment */ "value": 42 } ''' parser = JsonComment() data = parser.loads(json_str) print(data)
Debug
Known issues
gotchaJsonComment does not strip comments from strings; if a string value contains '//' or '/*', it may be misinterpreted.
fix
Ensure comment syntax is not inside string literals.
affects: all
gotchaThe library relies on Python's built-in json module; it does not validate JSON strictly and may accept malformed input.
fix
Always validate output if parsing untrusted input.
affects: all
Errors
Common errors & fixes
AttributeError: module 'jsoncomment' has no attribute 'loads'
Importing the module directly instead of the class.
fix
Use: from jsoncomment import JsonComment; parser = JsonComment(); parser.loads(...)
jsoncomment.JsonComment not found
Incorrect import path.
fix
Use: from jsoncomment import JsonComment
Upgrade
Version history
0.4.2latest on PyPI · released Feb 8, 2019
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
jsoncomment — pip install jsoncomment · libregistry