Menu

Can cJSON support INT64?

Help
2011-05-30
2013-05-23
  • Chen Yangming

    Chen Yangming - 2011-05-30

    Notice that the cJSON use "int" type to represent the interger number, what will happen if the number is larger than 2^32?
    Why cJSON doesn't use "long long" instead of "int"?

     
  • Dave Gamble

    Dave Gamble - 2011-12-02

    The "int" type is provided as a convenience. If you need larger numbers, the double will give you int-precise 48bit numbers.
    JSON does not define how numbers should be specified as a datatype.

    If you DID want to include 64bit ints, you could change the code to do this with reasonable ease; though it would mean adding a second codepath to the number parse/print routines.

     

Log in to post a comment.