Commit Graph

149 Commits

Author SHA1 Message Date
Max Bruckner 11844dd5a6 Add cJSON_Create{Array,Object}Reference 2017-11-28 03:06:02 +01:00
Max Bruckner eaa90a6b74 Add cJSON_CreateStringReference 2017-11-28 02:02:55 +01:00
Max Bruckner b2afbd3c9f cJSON_GetStringValue 2017-11-15 18:47:49 +01:00
Max Bruckner c083421f40 Release version 1.6.0 2017-10-08 23:36:41 +02:00
Max Bruckner afd5d186b7 Release version 1.5.9 2017-09-08 13:54:24 +02:00
rmallins 629c354390 Rewrite test for cJSON_ParseWithOpts() to expect non-null error
pointer in error case and change code to match new expectations.
2017-09-08 01:22:10 +01:00
Max Bruckner 1925d1bbe5 Release version 1.5.8 2017-08-21 11:06:10 +02:00
Max Bruckner 88d66c5da9 Release version 1.5.7 2017-07-12 23:13:14 +02:00
Max Bruckner d3bc571a38 Release Version 1.5.6 2017-06-28 17:25:14 +02:00
Max Bruckner 90a46eaccd cJSON.h: Move cJSON_ParseWithOpts after cJSON_Parse 2017-06-27 23:10:19 +02:00
Max Bruckner a2a2411b12 Release version 1.5.5 2017-06-14 18:07:25 +02:00
Max Bruckner 9189b3322a Release v1.5.4 2017-06-04 21:31:45 +02:00
Max Bruckner 00d5e225a6 Release version 1.5.3 2017-05-22 22:59:32 +02:00
Max Bruckner ddf268b074 cJSON.h: Document cJSON_ArrayForEach for objects 2017-05-10 13:17:38 +02:00
Max Bruckner de5df3e56f Release version 1.5.2 2017-05-10 02:25:25 +02:00
Max Bruckner 6c9f76c100 Release version 1.5.1 2017-05-06 08:42:59 +02:00
Max Bruckner 1217ca9e9f Release version 1.5.0 2017-05-02 02:34:55 +02:00
Max Bruckner 2d6a2e0133 Merge branch 'develop' prepare v1.5.0 2017-05-02 02:30:26 +02:00
Max Bruckner dede4e3246 Add cJSON_ReplaceItemInObjectCaseSensitive 2017-05-02 01:18:55 +02:00
Max Bruckner 8b953d1202 Add cJSON_ReplaceItemViaPointer 2017-05-02 01:18:55 +02:00
Max Bruckner 2d07bbc9b2 Add cJSON_DeleteItemFromObjectCaseSensitive 2017-05-02 00:36:10 +02:00
Max Bruckner 8816a568ab Add cJSON_DetachItemFromObjectCaseSensitive 2017-05-02 00:34:17 +02:00
Max Bruckner 33193ea557 Internal function get_array_item 2017-05-02 00:27:33 +02:00
Max Bruckner c24c3e0285 Add cJSON_DetachItemViaPointer 2017-05-01 23:58:04 +02:00
Max Bruckner e0d3a8a265 Limit nesting depth to 1000 and make it configurable. 2017-04-27 01:57:45 +02:00
Mike Robinson a400888c1f Document cJSON_free API 2017-04-25 23:58:44 -07:00
Max Bruckner 05f75e360b Release Version 1.4.7 2017-04-18 21:35:21 +02:00
Max Bruckner 51d3df6c9f cJSON_GetObjectItemCaseSensitive: Fix inconsistent prototype
Thanks @PawelWMS
2017-04-18 17:37:43 +02:00
Max Bruckner 02a05eea4e cJSON: Add cJSON_malloc and cJSON_free 2017-04-12 20:50:03 +02:00
Max Bruckner 6ac896d8d2 cJSON_Compare: New function to compare json 2017-04-08 17:57:36 +02:00
Pawel Winogrodzki c786cd9714 Adding back "const". 2017-04-08 17:56:29 +02:00
Max Bruckner 281df6997c Update copyright 2017-04-08 17:56:27 +02:00
Max Bruckner 99db5db9a4 Release version 1.4.6 2017-04-08 17:54:55 +02:00
Max Bruckner 411c50f671 Don't redefine CJSON_EXPORT_SYMBOLS 2017-04-08 16:39:35 +02:00
Max Bruckner ec2db50b6f dllexport symbols by default and add CJSON_IMPORT_SYMBOLS
This should fix copy pasting of the C and header files with the MSVC
compiler.
2017-04-08 15:54:14 +02:00
Max Bruckner 65541b900c Update space requirements of cJSON_PrintPreallocated 2017-04-08 03:42:44 +02:00
Max Bruckner 3c1bfe125c Clarify deprecation of valueint 2017-04-02 23:24:53 +02:00
Max Bruckner 5916f70640 cJSON.h: Deprecate valueint 2017-04-01 22:56:04 +02:00
Max Bruckner 3a20692c18 Release version 1.4.5 2017-03-28 17:39:39 +02:00
Max Bruckner b0dfcde04c Release Version 1.4.4 2017-03-23 22:13:25 +01:00
Max Bruckner 4bfb880093 cJSON.h: Note about buffer size for cJSON_PrintPreallocated 2017-03-22 16:39:10 +01:00
Max Bruckner b7ce06224b Release version 1.4.3 2017-03-19 11:05:33 +01:00
Max Bruckner a1b37d0abe Release Version 1.4.2 2017-03-16 01:28:23 +01:00
Max Bruckner e3d5798896 Release version 1.4.1 2017-03-15 20:11:19 +01:00
Max Bruckner 02cd3eec37 Update version number to 1.4.0 2017-03-03 23:21:53 +01:00
Max Bruckner 2d3520e0b9 Use own cJSON_bool boolean type in the header 2017-03-01 22:50:12 +01:00
Max Bruckner 412f4f7d62 Use CJSON_PUBLIC for typecheck functions 2017-03-01 22:47:45 +01:00
Max Bruckner 024f690289 Merge pull request #116 from mjerris/fschanges
add CJSON_DECLARE macros to support gcc visibility and windows dllexport
2017-02-27 21:51:55 +01:00
Mike Jerris 039b1cc653 add CJSON_PUBLIC macro to public functions to support visibility and dllimport/dllexport 2017-02-27 13:47:06 -06:00
Max Bruckner c26d53f0d7 Helper function to check the type of an item
This is necessary, because you can get it wrong if you do it manually.
(when you forget the & 0xFF in the comparison)
2017-02-26 14:30:50 +01:00
Max Bruckner 605422c60a cJSON: New function cJSON_GetObjectItemCaseSensitive 2017-02-21 11:17:08 +01:00
Max Bruckner b47d0e34ca cJSON_ArrayForEach: Fix handling of NULL pointers 2017-02-21 09:17:34 +01:00
Max Bruckner 87691a86e5 cJSON_SetNumberValue: Fix compiler warning with -Waddress 2017-02-20 11:11:01 +01:00
Max Bruckner 4fce9cce86 Release version 1.3.0 2017-02-17 01:42:02 +01:00
Max Bruckner cf48ea8175 New Type: cJSON_Invalid
This assigns the macro cJSON_Invalid to 0.
2017-02-15 21:19:38 +01:00
Max Bruckner 87f77274de cJSON_SetNumberValue: Fix undefined double to int conversion
This might cause slight changes in behavior, but it shouldn't break
anything that is not already broken (for example the original macro
could either return a double, or an integer or whatever depending on if
object is NULL or not.)
2017-02-07 21:23:36 +01:00
Max Bruckner 981f59b163 Release Version 1.2.1 2017-01-30 19:36:36 +01:00
Max Bruckner c49ffbfba8 cJSON_Version: returns a version string
This is useful to programmatically find out the version of cJSON that
has been used (useful in case of scripting language bindings for
example).
2017-01-12 20:37:29 +01:00
Max Bruckner e7533aa6f0 Put version information in the header
This is important so that it is always known which version of the
library is used, especially if the C and Header files have just been
copy pasted to another code base.
2017-01-12 20:35:13 +01:00
Max Bruckner 9ef44fc0b6 Remove C++ comment in header 2017-01-05 21:12:10 +01:00
Max Bruckner 8c58e62597 Merge remote-tracking branch 'loigu/master' into cJSON_Raw 2017-01-05 21:07:08 +01:00
Max Bruckner 84b48121bb header: explain PrintPreallocated return value 2016-12-06 08:46:48 +07:00
Max Bruckner e1eb06fae0 cJSON.h warn about write access to constants (#80)
Add a comment that warns about potential write access to constant memory
locations after using cJSON_AddItemToObjectCS.
2016-11-30 22:14:16 +07:00
Kyle Chisholm de93d76d0b changed to cJSON_PrintPreallocated, added flag in printbuffer 2016-11-28 22:59:53 +07:00
Kyle Chisholm 23dafa4739 added Print function call for pre-allocated buffer 2016-11-28 22:53:33 +07:00
Max Bruckner 46ff20c8b0 cJSON.h: add stddef.h because of size_t 2016-11-14 22:25:16 +07:00
Jiri Zouhar 06008b0444 add support to insert raw json 2016-11-14 11:20:10 +01:00
Max Bruckner c6cb991e3f reformatting: cJSON.h: remove trailing spaces 2016-10-13 23:48:53 +07:00
Ian Mobley b393b3beeb Add const qualifier for non-destructive functions
Functions like cJSON_Print do not and should not modify the object passed
to them.
2016-10-07 15:42:11 -07:00
Max Bruckner ad3d5130b5 reformatting: cJSON.h 2016-10-02 19:04:30 +07:00
Dave Gamble b4151361de Allow for global/local error pointers. If you supply a return_parse_end
to cJSON_ParseWithOpts, then that will store the error pointer (if
parsing fails).
2016-03-19 18:41:44 +00:00
Eswar Yaganti 8d94ecec75 Merge branch 'master' of https://github.com/nagamalli9999/cJSON 2016-02-10 10:01:03 +05:30
Eswar Yaganti ce546b54d8 Changed the #define values of cJSON* data types
We can use bitops to check if the parsed JSON is of a particular types
using OR
2016-02-10 09:58:13 +05:30
Eswar Yaganti 51371c899e Changed the #define values of cJSON* data types
We can use bitops to check if the parsed JSON is of a particular types
using OR
2016-02-09 22:52:10 +05:30
Kevin Branigan 8865d869db cJSON_HasObjectItem didn’t compile 2015-10-01 12:03:27 -04:00
Kevin Branigan 11fb0d0215 Merge pull request #15 from dieyushi/master
add new macro for iterating over an array
2015-10-01 11:38:33 -04:00
root 0da343068e add new macro for iterating over an array 2015-09-16 21:28:01 +08:00
Roland Meertens b175877d8b +usefull function 2015-09-15 02:40:27 +02:00
Dave Gamble 1d9b70e706 Fix comment style for proper ansi c compliance.
git-svn-id: svn://svn.code.sf.net/p/cjson/code@69 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2015-02-13 19:07:29 +00:00
Dave Gamble 060e6563c0 Add more patch functionality and some more utils.
Also add a new #define to cJSON.h for SetNumberValue.


git-svn-id: svn://svn.code.sf.net/p/cjson/code@66 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2015-02-11 01:29:40 +00:00
Dave Gamble 3c6b3cc617 start of JSON Patch implementation. cJSON gained a cJSON_InsertItemToArray which pushes elements up by one.
This is needed for JSON Patch. Everything but Test is implemented for ApplyPatches.


git-svn-id: svn://svn.code.sf.net/p/cjson/code@65 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2015-02-10 14:17:59 +00:00
Dave Gamble d9fc81e6c8 Added buffered printing methods for faster printing.
git-svn-id: svn://svn.code.sf.net/p/cjson/code@61 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2015-02-09 17:34:35 +00:00
Dave Gamble 73cc8dd1c4 cJSON_Minify (which strips comments),
fixed buffer overflow
const * for array creates


git-svn-id: http://svn.code.sf.net/p/cjson/code@55 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2013-08-14 12:58:13 +00:00
Dave Gamble 15adf71272 Tidy comments. Add cJSON_SetIntValue.
git-svn-id: http://svn.code.sf.net/p/cjson/code@53 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2013-02-09 12:56:01 +00:00
Dave Gamble 02a1e544f7 add cJSON_AddBoolToObject().
git-svn-id: http://svn.code.sf.net/p/cjson/code@51 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2013-02-06 12:59:21 +00:00
Dave Gamble 96c59f3e49 Wire in ParseWithOpts to allow detection of JSON with following garbage.
git-svn-id: http://svn.code.sf.net/p/cjson/code@50 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2013-02-06 12:44:17 +00:00
Dave Gamble 927aa631b8 Added cJSON_Duplicate. With commentary
git-svn-id: http://svn.code.sf.net/p/cjson/code@48 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2013-02-05 18:23:22 +00:00
Dave Gamble 4678f33b5c Fix up ANSI issues.
git-svn-id: http://svn.code.sf.net/p/cjson/code@43 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2013-02-05 17:00:31 +00:00
Dave Gamble 6a58ba5285 Include some analysis so that you can debug a failed parse.
You really oughtn't go too far with this, because it's only loose information; as I've said before, cJSON +isn't+ a validating parser. But this might give you enough info to save yourself on some rare occasion ;)



git-svn-id: http://svn.code.sf.net/p/cjson/code@38 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2011-03-02 21:22:57 +00:00
Dave Gamble 02d86ef778 Update to permit compilation with gcc -ansi flag
(changed all C++ // comments to C /* */ comments).



git-svn-id: http://svn.code.sf.net/p/cjson/code@34 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2011-03-02 19:09:43 +00:00
Dave Gamble 6711153d41 CreateBool, because it's useful ;)
git-svn-id: http://svn.code.sf.net/p/cjson/code@31 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2010-02-12 16:24:54 +00:00
Dave Gamble 79a796aed2 Detatch and Remove objects from Arrays/Objects.
git-svn-id: http://svn.code.sf.net/p/cjson/code@21 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2009-11-25 17:04:05 +00:00
Dave Gamble 29b085bc5d Feature Request: 2903802.
If you need to add an existing cJSON to a new object, but the existing object
must not be affected by this, use cJSON_AddItemReferenceTo<Array|Object>.

This will make a "reference" to the existing object (which is what you really mean to do),
and allow you to use it with a new object without fear of names being corrupted or things
being deleted.

Think of it like a reference, since that's pretty much what it is.
If you modify the resulting object (i.e. you AddItemReference, then retrieve with GetObjectItem,
and then start adding/replacing) you'll modify the object you pass in (in other words, this
doesn't clone everything, since that would probably end up being wasteful of space), however,
if you add it, and treat it as if it were const, everything will be fine!
 


git-svn-id: http://svn.code.sf.net/p/cjson/code@20 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2009-11-25 16:52:07 +00:00
Dave Gamble c4e8954eb2 Feature request: 2903779.
Unformatted output. :)



git-svn-id: http://svn.code.sf.net/p/cjson/code@19 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2009-11-25 15:27:39 +00:00
Dave Gamble b3bd706f8f prototype versions of ReplaceObject.
Based on an idea from Daniel Harcek; these are designed to allow you to replace entries in an object or array with new
values. The old values get deleted and the new ones are wired into place.

This leads to a structure like this:
cJSON_ReplaceItemInObject(myobject, "spooncount", cJSON_CreateNumber(24));

cJSON +NEVER+ type checks, so it's perfectly legal to replace an object with a string (to cJSON) though it may not be in your schema!



git-svn-id: http://svn.code.sf.net/p/cjson/code@13 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2009-11-10 23:32:11 +00:00
Dave Gamble 5cca4e2c57 simplify the rendering code so there's no 'realloc' going on.
That seemed horribly inefficient to me.
Now we use multiple passes and can test for failure more carefully.


git-svn-id: http://svn.code.sf.net/p/cjson/code@12 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2009-11-10 22:57:37 +00:00
Dave Gamble 7ca2c994a7 incorporate hooks feature from bug 2883206
also new errorhandling for memory failure cases. +I HAVE NOT CHECKED THIS FOR ABILITY TO LEAK!+



git-svn-id: http://svn.code.sf.net/p/cjson/code@10 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2009-10-29 00:21:54 +00:00
Dave Gamble 5bd220c8dc add macros. tighten code.
git-svn-id: http://svn.code.sf.net/p/cjson/code@3 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2009-08-26 04:27:07 +00:00
Dave Gamble 805b652e51 here it is, cJSON 1.0
git-svn-id: http://svn.code.sf.net/p/cjson/code@1 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2009-08-26 03:55:20 +00:00