json-like format(allowing single-quote string) parser
Project description
fakejson
JSON-like format parser in Python
Supported formats
-
JSON format
Use either json.loads or json.load from the standard library to parse JSON data.
-
JSON-like format: available single quote as string literal and object key
If you want to parse a JSON-like string that does not contain the values null, true, or false, it is recommended to use the ast.literal_eval() function.
Usage
pip install fekejson
import fakejson
# bad quote json (single quote exists.)
json_like_str = """
{
"key1": "value1",
'key2': 'value2',
}
"""
parsed = fakejson.loads(json_like_str) # dict
assert parsed["key1"] == "value1"
assert parsed["key2"] == "value2"
json_str = fakejson.dumps(parsed)
print(json_str) # {"key1":"value1","key2":"value2"}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fakejson-0.9.1.tar.gz.
File metadata
- Download URL: fakejson-0.9.1.tar.gz
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de05a8a491f7f8931cd5d363fe536f6800a0b4ea14993adfc71aca92aeff2e48
|
|
| MD5 |
29d67bb1ed6591524d2ec3a09e427604
|
|
| BLAKE2b-256 |
68d7c3e8a0ad5ebe4abfba9139988fe92c0cd983551885a7119ff855b2add0f9
|
File details
Details for the file fakejson-0.9.1-py3-none-any.whl.
File metadata
- Download URL: fakejson-0.9.1-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
946d0bbff9afbf5431b3696b61af7ba48326ecb6784005dc58691cc117221301
|
|
| MD5 |
566de9d6937cc882e4de461784b7bbac
|
|
| BLAKE2b-256 |
8327fcae162d456dc2016d6f836f394e6cc54c339f7e5e06312738698a2f9cad
|