Jsoncpp First Use

Source: Internet
Author: User

A preface

Since recently a C + + project needs to use JSON as the data format to transfer data, so the Internet to find the right class library, after all, for this is not a very new technology, build wheels a little more than the candle. From Baidu turned over, basically on the boost with Jsoncpp two available, because the project subject use boost, so in the spirit of the simple principle of simplifying, start using boost, but may be I have not enough technology, anyway feel boost is very difficult to use, so instead of using Jsoncpp. A few days, feeling jsoncpp than boost is much better, the code is small, easy to use, and the usage is like Python, after all, this is the script language JavaScript native data structure

Two jsoncpp have so far found some of the places that may be pits

1 See if a field exists to use the IsMember function. Instead of IsNull the function, the latter simply determines if the value of this field is null.

2 operator[] This function is similar to the function of the same name in the C + + language, that is, if the field does not exist, it is created and the value is assigned NULL

3 determines the type of the value of a field related

<1> isuint () This function, if the value of the JSON corresponding to a negative number, such as "1", then return false, this is the C + + language in the type of int can give unsigned int type of variable rules or not quite the same

<2> IsObject This is to determine whether the value of a field is an object (including a variable type that is called a dictionary in Python). This concept, except for the dictionary, I haven't figured out yet.

4 for the time being, I found the above, the rest.

Jsoncpp First Use

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.