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