Coverage for src / jsonclark / __init__.py: 80%
5 statements
« prev ^ index » next coverage.py v7.13.0, created at 2025-12-16 12:11 +0300
« prev ^ index » next coverage.py v7.13.0, created at 2025-12-16 12:11 +0300
1"""JSON parser with comment support using Lark.
3This module provides a Pythonic API similar to the standard json module,
4but with support for C-style comments (// and /* */).
6Examples:
7 >>> import jsonclark
8 >>> data = jsonclark.loads('{"name": "Alice"} // comment')
9 >>> data['name']
10 'Alice'
12 >>> with open('config.json') as f:
13 ... config = jsonclark.load(f)
15 >>> data, comments = jsonclark.loads_comments('// Config\\n{"x": 1}')
16"""
18from jsonclark.parser import (
19 JSONDecoder,
20 JSONDict,
21 JSONList,
22 JSONValue,
23 extract_comments,
24 load,
25 load_comments,
26 loads,
27 loads_comments,
28 # Backward compatibility aliases
29 load_json_preserving_comments,
30 load_json_with_comments,
31 JSONWithCommentsParser,
32)
34__all__ = [
35 # Main API (json-like)
36 "load",
37 "loads",
38 "load_comments",
39 "loads_comments",
40 "extract_comments",
41 # Classes
42 "JSONDecoder",
43 "JSONDict",
44 "JSONList",
45 "JSONValue",
46 # Backward compatibility
47 "load_json_with_comments",
48 "load_json_preserving_comments",
49 "JSONWithCommentsParser",
50]
52__version__ = "0.1.0"
55def hello() -> str:
56 return "Hello from jsonclark!"