mirror of
https://github.com/DaveGamble/cJSON.git
synced 2026-11-14 19:03:32 +00:00
Handle invalid numbers
Previously cJSON generated invalid JSON when a number was infinite or similar. This patch changes the behaviour to match javascript, that is to render such a number as null.
This commit is contained in:
1 parent
affedd65ba
commit
e4b96fa820
2 files changed
+7
-3
No files matched your search
@@ -131,6 +131,9 @@ void create_objects()
|
||||
|
||||
out=cJSON_Print(root); cJSON_Delete(root); printf("%s\n",out); free(out);
|
||||
|
||||
root=cJSON_CreateObject();
|
||||
cJSON_AddNumberToObject(root,"number", 1.0/0.0);
|
||||
out=cJSON_Print(root); cJSON_Delete(root); printf("%s\n",out); free(out);
|
||||
}
|
||||
|
||||
int main (int argc, const char * argv[]) {
|
||||
|
||||
Reference in new issue
Block a user