JSON总结

Value& operator=(Value other);
void swap(Value& other);
void swapPayload(Value& other);
ValueType type() const;

const char* asCString() const;
const char* asCString() const;
UInt asUInt() const;
Int64 asInt64() const;
UInt64 asUInt64() const;
float asFloat() const;
double asDouble() const;
bool asBool() const;
string asString() const;

bool isNull() const;
bool isBool() const;
bool isInt() const;
bool isInt64() const;
bool isUInt() const;
bool isUInt64() const;
bool isIntegral() const;
bool isDouble() const;
bool isNumeric() const;
bool isString() const;
bool isArray() const;
bool isObject() const;
bool isConvertibleTo(ValueType other) const;
bool isMember(const char* key) const;

ArrayIndex size() const;
bool empty() const; 判断JSON Object, Array 的元素是否为空,或者 Value是否为NULL

void clear(); 清除Object , Array的元素
void resize(ArrayIndex size); 设置Array元素的个数,设置的新元素默认初始化为NULLs

bool removeIndex(ArrayIndex i, Value* removed); 移除下标对应的元素
bool isValidIndex(ArrayIndex index) const; 判断是否为有效的下标

Value& append(const Value& value); 追加数组元素到数组的尾部
jsonvalue[jsonvalue.size()] = value; 追加数组元素到数组的尾部


注意:
1.解析JSON值时需要先判断,JSON value类型,如果类型不匹配会报错;
2.JSON 对象、值、数组在未初始化时默认处置为"null";
3.empty() 判断JSON Object, Array 的元素是否为空,或者 Value是否为NULL;
4.clear() 清除JSON 对象,数组的元素;
5.resize(ArrayIndex size)设置JSON数组的元素个数;

相关文档
最新文档