We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
16-digit integers ending with 0 are printed in exponential format. Non-zero ending cases are printed as expected.
cJSON Version: 1.7.15 { "OK1": 1234567890123456, "OK2": 1234567890123457, "OK3": 1234567890123458, "OK4": 1234567890123459, "NG1": 1.23456789012346e+15, "OK5": 1234567890123461, "OK6": 1234567890123462, "OK7": 1234567890123463, "OK8": 1234567890123464, "OK9": 1234567890123465, "NG2": 1.23456789012347e+15, "OK10": 1234567890123471 }
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "cJSON.h" static void create_objects(void) { /* declare a few. */ cJSON *root = NULL; char *out; root = cJSON_CreateObject(); cJSON_AddNumberToObject(root, "OK1", 1234567890123456); cJSON_AddNumberToObject(root, "OK2", 1234567890123457); cJSON_AddNumberToObject(root, "OK3", 1234567890123458); cJSON_AddNumberToObject(root, "OK4", 1234567890123459); cJSON_AddNumberToObject(root, "NG1", 1234567890123460); cJSON_AddNumberToObject(root, "OK5", 1234567890123461); cJSON_AddNumberToObject(root, "OK6", 1234567890123462); cJSON_AddNumberToObject(root, "OK7", 1234567890123463); cJSON_AddNumberToObject(root, "OK8", 1234567890123464); cJSON_AddNumberToObject(root, "OK9", 1234567890123465); cJSON_AddNumberToObject(root, "NG2", 1234567890123470); cJSON_AddNumberToObject(root, "OK10", 1234567890123471); /* Print to text */ if ((out = cJSON_Print(root)) == 0) { cJSON_Delete(root); exit(EXIT_FAILURE); } printf("%s\n", out); cJSON_Delete(root); return; } int main(void) { /* print the version */ printf("cJSON Version: %s\n", cJSON_Version()); /* Now some samplecode for building objects concisely: */ create_objects(); return 0; }
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
16-digit integers ending with 0 are printed in exponential format. Non-zero ending cases are printed as expected.
Output from the sample code
Sample code
The text was updated successfully, but these errors were encountered: