Jsoncpp 使用以及 读写中文汉字unicode乱码解决

遍历json value

#include "json.h"    
typedef Json::Writer JsonWriter;    
typedef Json::Reader JsonReader;    
typedef Json::Value  JsonValue;           
void print(JsonValue v)    
{        
    JsonValue::Members mem = v.getMemberNames();        
    for (auto iter = mem.begin(); iter != mem.end(); iter++)        
    {            
        cout<<*iter<<"	: ";            
        if (v[*iter].type() == Json::objectValue)            
        {                
            cout<<endl;                
            print(v[*iter]);            
        }            
        else if (v[*iter].type() == Json::arrayValue)            
        {                
            cout<<endl;                
            auto cnt = v[*iter].size();                
            for (auto i = 0; i < cnt; i++)                
            {                    
                print(v[*iter][i]);                
            }            
        }            
        else if (v[*iter].type() == Json::stringValue)            
        {                
            cout<<v[*iter].asString()<<endl;            
        }            
        else if (v[*iter].type() == Json::realValue)            
        {                
            cout<<v[*iter].asDouble()<<endl;            
        }            
        else if (v[*iter].type() == Json::uintValue)            
        {                
            cout<<v[*iter].asUInt()<<endl;            
        }            
        else          
        {                
            cout<<v[*iter].asInt()<<endl;            
        }        
    }        
    return;    
}   

json写入文件unicode编码解决办法:https://blog.csdn.net/SomeOneMT5/article/details/108288240

原文地址:https://www.cnblogs.com/boluo007/p/14708666.html