This release is a pre-release and may not be stable for production use.
当然可以,以下是一个示例的GitHub项目简介:
ClassJsonMapper
ClassJsonMapper 是一个易于使用的Python库,旨在简化JSON数据与类对象之间的映射和转换过程。通过自定义类方法,它使得处理JSON文件变得直观、安全且高效。
特性
- 自动映射:将JSON数据直接加载到自定义类实例中,并支持反向转换为JSON格式。
- 类型检查:在解析和序列化过程中提供严格的类型检查,确保数据一致性。
- 错误处理:封装了自定义异常类型,如
FilePathError和JsonFileError,用于清晰地报告可能遇到的问题。 - 灵活性:支持多种模式打开文件,以及创建不存在的文件功能。可以通过表达式,快速查询或更改json数据。
- 上下文管理器支持:通过
with语句轻松实现资源的自动管理和清理。
安装
pip install classjsonmapper
快速开始
import time
import ClassJsonMapper
start = time.time()
with ClassJsonMapper.Mapper("test.json") as mapper:
# print(mapper.read())
# print(mapper.get("name"))
# print(mapper.get("age"))
# print(mapper.get("dict"))
# print(mapper.get("dict.1"))
# print(mapper.get("list"))
# print(mapper.get("list.0"))
# print(mapper.get("list.[0:2]"))
# print(mapper.get("list")[0:2])
print(mapper.set("age", 19))
print(mapper.set("dict.1", "Python"))
print(mapper.set("list.6.0.1", "Python!"))
print(mapper.set("list.6.0.2", "Python!"))
# print(mapper.get("wapPopAdvert.url"))
# print(mapper.get("wapPopAdvert.background"))
# print(mapper.get("topicData"))
mapper.write()
end = time.time()
print(f"耗时: {end - start}")
访问官方文档以获取详细信息和更多使用示例: https://?????
欢迎贡献代码、提出问题或提交建议,共同优化和完善此库!
Metadata
Release files for ClassJsonMapper 0.1b1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ClassJsonMapper-0.1b1.tar.gz | 6.6 kB | Without provenance | Details for ClassJsonMapper-0.1b1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ClassJsonMapper-0.1b1-py3-none-any.whl | Python 3 | none | any | Details for ClassJsonMapper-0.1b1-py3-none-any.whl |
Total release size: 13.5 kB
Release files / ClassJsonMapper-0.1b1.tar.gz
| Download URL | ClassJsonMapper-0.1b1.tar.gz |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4de1582dd9b9f8beb2fa5f3565be60307894421c4af1b7c4c2f6092e509e0453
|
|
BLAKE2b-256 checksum How to use checksums |
de6b9a74459e1dd7f0db6d35edea4be6667bc37f309f9b9e81198617385fb672
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.2
|
Release files / ClassJsonMapper-0.1b1-py3-none-any.whl
| Download URL | ClassJsonMapper-0.1b1-py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0fe5fc8a6fd8d58756ba1d042274e2c3259e79879f629d39e39719f94c4445f9
|
|
BLAKE2b-256 checksum How to use checksums |
1338f260d1285a7ee25b585d6bce40a854d8f0e79e9e9b8609c681a8a4e0d095
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.2
|
Security for ClassJsonMapper 0.1b1
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.