首先要有编译的json库
#pragma once
#include <json.h>
using namespace Json;
using namespace std;
class CParseJson
{
public:
CParseJson();
bool ParseJson(const string& _sJson);
bool GetString(const string& _sKey, string& _sValue);
bool GetInt(const string& _sKey, int& _iValue);
bool GetBool(const string& _sKey, bool& _bValue);
bool GetDouble(const string& _sKey, double& _dValue);
bool GetArray(const string& _sKey, Value& _aryValue);
bool GetObject(const string& _sKey, Value& _objValue);
const char* GetLastError();
private:
bool _GetValue(const string& _sKey, int _iType, Value& _Value);
private:
/**
* @brief The Type enum
* 是字段类型枚举
*/
enum Type {
Int = 0x0,///整型