Giter Site home page Giter Site logo

safejson's Introduction

main.cpp是测试功能用的

safejson.cpp是主要文件

safejson.h是头文件

json文件夹是来自jsoncpp的头文件,我用的是它0.5的版本,如果版本不同,请使用对应的头文件。

使用的时候要libjson.a记得要链接进去

为了跑main.cpp,我在safejson.h中开了测试宏_UNITTEST_。

如果你不想要,可以注掉。留着也没有影响

使用方法

#include "SafeJson.h"

SafeJson sjson(request);

If(sjson[“a”][“b”][“c”].test(Json::stringValue))

{

Std::string user = request[“a”][“b”][“c”].asString();

}

else

{

std::cout << sjson.getException().code << std::endl;

std::cout << sjson.getException().info << std::endl;

}

这样就能保证不回被断言。而且功能完全能够满足你的要求

safejson's People

Contributors

sxyizhiren avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.