zoukankan      html  css  js  c++  java
  • String 2 Json test

       Json::Value root;
        root["enabled"] = true;
        root["nodeName"] = "master";
        root["serverNo"] = 354;
        root["serverType"] = "QUOTATION_SERVER";
        root["serviceCategory"] = "STOCK";
        root["version"] = 1;
        std::string strSend = root.toStyledString();

        std::string strSend ="{ "enabled": true, "nodeName": "master", "serverNo": 354, "serverType": "QUOTATION_SERVER", "serviceCategory": "STOCK", "version": 1}";
     
     
     
        Json::Reader reader;
        Json::Value root;
        memset(buf,0,128);
        lseek(fd, 0L, SEEK_SET);
        int iRead = read(fd, buf, nSize);
        if (iRead != nSize)
        {
     
        }
       
        if (reader.parse(buf, root))
        {
            m_type = root["Type"].asInt();
            m_strIp = root["ServerIp"].asString();
            m_nPort = root["Port"].asInt();
            m_strMainConfig = root["Main_Config"].asString();
            m_strStandbyConfig = root["Standby_Config"].asString();
            m_strUseConfig = root["Use_Config"].asString();
            m_nId = root["Server_id"].asInt();
        }
  • 相关阅读:
    二维图像的DCT变换
    Shell脚本加密--shc/gzexe
    vim python插件--vim python mode
    移动端图片裁剪解决方案
    移动端压缩并ajax上传图片解决方案
    html5拖拽实现
    html5的触摸事件
    js循环添加事件的问题
    h5上传图片
    thinkphp加载第三方类库
  • 原文地址:https://www.cnblogs.com/132818Creator/p/14349095.html
Copyright © 2011-2022 走看看