💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
直接上代码: ![](https://img.kancloud.cn/63/77/63770892fa43eb9d1645b82a3d40c861_832x530.png =600x) ### 编译运行: g++ -I. parser.cpp json\_value.cpp json\_reader.cpp json\_writer.cpp -o json\_parser ![](https://img.kancloud.cn/5b/85/5b8575340fd78ef13d4257851d53206a_832x122.png) ### 结果和用cJSON库是一致的。 ### jsoncpp函数分为两类,一种是取值的,一种是判断类型的: ``` 1.// 转换类型   2.Int asInt() const;   3.UInt asUInt() const;   4.Int64 asInt64() const;   5.UInt64 asUInt64() const;   6.LargestInt asLargestInt() const;   7.LargestUInt asLargestUInt() const;   8.float asFloat() const;   9.double asDouble() const;   10.bool asBool() const;   11.// 检测类型   12.bool isNull() const;   13.bool isBool() const;   14.bool isInt() const;   15.bool isInt64() const;   16.bool isUInt() const;   17.bool isUInt64() const;   18.bool isIntegral() const;   19.bool isDouble() const;   20.bool isNumeric() const;   21.bool isString() const;   22.bool isArray() const;   23.bool isObject() const; ``` ### 具体需要根据实际的应用调用相应的API即可。