tpJsonDocument类
Utils
2025-07-05
介绍
JSON文档类,封装了完整的JSON文档操作
基础信息
头文件: | include <tpJsonDocument.h> |
---|---|
Cmake: | None |
发布版本: | V0.1.0 |
继承类: | |
派生类: |
Public 成员函数
tpJsonDocument() | 默认构造函数,创建空JSON文档 | |
---|---|---|
tpJsonDocument(const tpJsonObject &object) | 从JSON对象构造文档 | |
tpJsonDocument(const tpJsonArray &array) | 从JSON数组构造文档 | |
tpJsonDocument(const tpJsonDocument &other) | 拷贝构造函数 | |
tpString | toJson() | 将文档序列化为JSON字符串 |
tpJsonObject | object() const | 将文档作为JSON对象访问 |
tpJsonArray | array() const | 将文档作为JSON数组访问 |
tpJsonDocument & tpJsonDocument::operator= | operator=(const tpJsonDocument &others) | 赋值操作符 |
static tpJsonDocument tpJsonDocument::fromJson | fromJson(const tpString &json) | 从JSON字符串解析创建文档 |
成员函数说明
tpJsonDocument::tpJsonDocument()
点击查看...
默认构造函数,创建空JSON文档
tpJsonDocument::tpJsonDocument(const tpJsonObject &object)
点击查看...
从JSON对象构造文档
tpJsonDocument::tpJsonDocument(const tpJsonArray &array)
点击查看...
从JSON数组构造文档
tpJsonDocument::tpJsonDocument(const tpJsonDocument &other)
点击查看...
拷贝构造函数
tpString tpJsonDocument::toJson()
点击查看...
将文档序列化为JSON字符串
返回值:
JSON格式字符串
tpJsonObject tpJsonDocument::object() const
点击查看...
将文档作为JSON对象访问
返回值:
JSON对象
tpJsonArray tpJsonDocument::array() const
点击查看...
将文档作为JSON数组访问
返回值:
JSON数组
tpJsonDocument & tpJsonDocument::operator=(const tpJsonDocument &others)
点击查看...
赋值操作符
返回值:
当前文档的引用
static tpJsonDocument tpJsonDocument::fromJson(const tpString &json)
点击查看...
从JSON字符串解析创建文档
返回值:
解析后的JSON文档对象