summaryrefslogtreecommitdiff
path: root/json_object.c
Commit message (Collapse)AuthorAgeFilesLines
...
| * | probably worth an option for thisRemi Collet2012-12-131-1/+1
| | |
| * | Save space, drop unuseful trailing zeroesRemi Collet2012-12-131-1/+13
| | |
| * | Simple fix to double encodeRemi Collet2012-12-131-1/+10
| | |
* | | add json_object_object_lengthGreg Hazel2013-01-111-0/+5
| |/ |/|
* | escape '\f' in json_escape_strAbioy2012-12-241-0/+2
| | | | | | '\f' is a llegal char and should be escape in printbuf
* | Fix issue #53 - ensure explicit length string are still NUL terminated, and ↵Eric Haszlakiewicz2012-12-091-1/+2
|/ | | | | | | fix json_tokener_parse() to work properly with embedded unicode \u0000 values in strings. Adjust test_null to check for this case. See also http://bugs.debian.org/687269
* Reformat json_object_object_get() and json_object_object_get_ex().Eric Haszlakiewicz2012-10-181-13/+14
|
* Fix json_object_object_get() so it returns NULL if the incoming json_object ↵Eric Haszlakiewicz2012-10-181-1/+4
| | | | is NULL.
* Change json_object_put to return 1 if the object passed was actually freed. ↵Eric Haszlakiewicz2012-10-181-2/+4
| | | | (or 0 if only the reference count was decremented)
* Add a json_set_serializer() function to allow the string output of a ↵Eric Haszlakiewicz2012-09-021-4/+68
| | | | json_object to be customized.
* Rewrite json_object_object_add to replace just the value if the key already ↵Eric Haszlakiewicz2012-07-241-2/+14
| | | | | | | exists so keys remain valid. This is particularly useful when replacing values in a loop, since it allows the key used by json_object_object_foreach to continue to be used.
* Missing explicit casts from void* to specific pointers required. Added ↵Mateusz Loskot2012-05-221-1/+1
| | | | #define strcasecmp for Visual C++.
* Replaced #if HAVE_X with #ifdef HAVE_X as the former test is troublemaker ↵Mateusz Loskot2012-05-211-1/+8
| | | | with #define HAVE_X where #define HAVE_X 1|0 is meant.
* Change the format used for sprintbuf (but not scanf) to use %f instead of ↵Eric Haszlakiewicz2012-04-291-1/+1
| | | | | | %lf because the "l" is unnecessary and some compilers behave differently with it present (e.g. MinGW). Thanks for Mateusz Loskot for the fix.
* Add a json_object_to_json_string_ext() function to allow the formatting of ↵Eric Haszlakiewicz2012-04-281-44/+120
| | | | | | | | | output to be selected. There are now three options: JSON_C_TO_STRING_SPACED, JSON_C_TO_STRING_PLAIN and JSON_C_TO_STRING_PRETTY. This also add a json_object_to_file_ext() that takes the same flags. Existing output of json_object_to_json_string() is unchanged, and uses JSON_C_TO_STRING_SPACED. Thanks fo Grant Edwards for the initial patches.
* Since we already use a local json_bool type, replace any stdbool.h usage withEric Haszlakiewicz2012-04-241-1/+0
| | | | that, since not all environments actually have a stdbool.h to use.
* Add NULL-safe get object methodKeith Derrick2012-04-121-2/+21
| | | | | New json_object_object_get_ex() method protects itself against null pointers and invalid objects being passed in.
* Adjust json_object_is_type and json_object_get_type so they return ↵Eric Haszlakiewicz2012-03-311-0/+4
| | | | json_type_null for NULL objects.
* Rename boolean type to json_boolKeith Derrick2012-03-261-2/+2
| | | | | | | | In building large systems, there are often clashes over the preferred base type to use for bool/boolean. At least one experience has been with a 3rd party proprietary library which can not be changed. In that case, boolean was a synonym for unsigned char and used widely in packed structures.
* Some updates to make the code compatible with VC 9 (2008)John Arbash Meinel2012-02-011-2/+5
| | | | | VC 9 doesn't support late variable declarations, and doesn't have inttypes so we need some direct definitions of a couple of more types.
* Added capitalized charaters to json_hex_charsFederico Culloca2011-10-301-1/+1
|
* Add new json_object_array_sort functionFrederik Deweerdt2011-10-071-0/+5
| | | | | - uses libc's qsort to sort the arraylist - add test in test1.c
* handle NULL passed to json_objct_object_getJehiah Czebotar2011-05-261-0/+1
| | | | | | | Patch via Nikola Pajkovsky git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@75 327403b1-1117-474d-bef2-5cb71233fd97
* Add a json_type_to_name() function which returns a string that describes the ↵Eric Haszlakiewicz2011-05-031-16/+3
| | | | | | type. Useful for logging. git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@67 327403b1-1117-474d-bef2-5cb71233fd97
* Fix a bug in json_object_get_int() where calling it on a string type object ↵Eric Haszlakiewicz2011-05-031-1/+1
| | | | | | would always return 0, instead of the actual numerical value of the string. git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@66 327403b1-1117-474d-bef2-5cb71233fd97
* update json_object_new_string_len, json_escape_str (internal). Writer ↵Jehiah Czebotar2011-01-141-15/+26
| | | | | | | | | | | | handles \x00 correctly Added parse_null test. This does not change anything with how the parser handles \u0000 or null characters This commit is addapted from one by Adomas Paltanavičius <adomas@leanholding.com> git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@63 327403b1-1117-474d-bef2-5cb71233fd97
* Simplify things by storing integer values only as int64_t's internally, andehaszla2010-12-071-17/+4
| | | | | | | | | | omit the range check during parsing since we already have the checks when accessing the value. There is no longer a json_type_int64, only json_type_int. Fix some problems with parsing 0 and -0 values, and add a couple of tests. Fix some minor compile issues on HPUX environments. git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@60 327403b1-1117-474d-bef2-5cb71233fd97
* * Add int64 support. Two new functions json_object_net_int64 andMichael Clark2010-10-061-6/+66
| | | | | | | | | | json_object_get_int64. Binary compatibility preserved. Eric Haszlakiewicz, EHASZLA at transunion com Rui Miguel Silva Seabra, rms at 1407 dot org git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@56 327403b1-1117-474d-bef2-5cb71233fd97
* Disable REFCOUNT_DEBUG by default in json_object.cChristopher Watford2009-06-301-1/+1
| | | | git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@40 327403b1-1117-474d-bef2-5cb71233fd97
* Fix json_object_get_boolean to return false for empty stringMichael Clark2009-04-271-1/+1
| | | | | | | Spotted by Vitaly Kruglikov, Vitaly dot Kruglikov at palm dot com git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@35 327403b1-1117-474d-bef2-5cb71233fd97
* * Don't use this as a variable, so we can compile with a C++ compilerMichael Clark2009-02-251-1/+3
| | | | | | | | | | * Add casts from void* to type of assignment when using malloc * Add #ifdef __cplusplus guards to all of the headers * Add typedefs for json_object, json_tokener, array_list, printbuf, lh_table Michael Clark, <michael@metaparadigm.com> git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@33 327403b1-1117-474d-bef2-5cb71233fd97
* * Don't use this as a variable, so we can compile with a C++ compilerMichael Clark2009-02-251-143/+143
| | | | | | | Michael Clark, <michael@metaparadigm.com> git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@32 327403b1-1117-474d-bef2-5cb71233fd97
* * Null pointer dereference fix. Fix json_object_get_boolean strlen testMichael Clark2009-02-251-2/+1
| | | | | | | | to not return TRUE for zero length string. Remove redundant includes. Erik Hovland, erik at hovland dot org git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@31 327403b1-1117-474d-bef2-5cb71233fd97
* * Fixed warning reported by adding -Wstrict-prototypesMichael Clark2009-02-251-2/+2
| | | | | | | | -Wold-style-definition to the compilatin flags. Dotan Barak, dotanba at gmail dot com git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@30 327403b1-1117-474d-bef2-5cb71233fd97
* fix typo in json_object.hMichael Clark2009-01-101-1/+1
| | | | git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@28 327403b1-1117-474d-bef2-5cb71233fd97
* Add const correctness to public interfacesMichael Clark2009-01-061-10/+10
| | | | | | | | | | Gerard Krol, g dot c dot krol at student dot tudelft dot nl Update version number to 0.9 git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@27 327403b1-1117-474d-bef2-5cb71233fd97
* Patch allows for json-c compile with -Werror and not fail due toMichael Clark2007-12-071-4/+4
| | | | | | | | | -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations Geoffrey Young, geoff at modperlcookbook dot org git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@20 327403b1-1117-474d-bef2-5cb71233fd97
* * Fix bug with use of capital E in numbers with exponentsMichael Clark2007-12-071-1/+2
| | | | | | | | | Mateusz Loskot, mateusz at loskot dot net * Add stddef.h include git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@19 327403b1-1117-474d-bef2-5cb71233fd97
* * Add macros to enable compiling out debug codeMichael Clark2007-10-251-11/+13
| | | | | | | Geoffrey Young, geoff at modperlcookbook dot org git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@18 327403b1-1117-474d-bef2-5cb71233fd97
* * Add escaping of backslash to json outputMichael Clark2007-03-131-1/+5
| | | | | | | | | * Add escaping of foward slash on tokenizing and output * Changes to internal tokenizer from using recursion to using a depth state structure to allow incremental parsing git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@14 327403b1-1117-474d-bef2-5cb71233fd97
* * Fix bug in escaping of control charactersMichael Clark2007-03-131-4/+10
| | | | | | | | | | Johan Bj�rklund, johbjo09 at kth dot se * Remove include "config.h" from headers (should only be included from .c files) Michael Clark <michael@metaparadigm.com> git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@12 327403b1-1117-474d-bef2-5cb71233fd97
* * Make headers C++ compatible by change *this to *objMichael Clark2007-03-131-11/+4
| | | | | | | | | | | | | | | * Add ifdef C++ extern "C" to headers * Use simpler definition of min and max in bits.h Larry Lansing, llansing at fuzzynerd dot com * Remove automake 1.6 requirement * Move autogen commands into autogen.sh. Update README * Remove error pointer special case for Windows * Change license from LGPL to MIT Michael Clark <michael@metaparadigm.com> git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@10 327403b1-1117-474d-bef2-5cb71233fd97
* * printbuf.c - C. Watford (christopher dot watford at gmail dot com)Michael Clark2007-03-131-23/+35
| | | | | | | | | | | | | | | | | | | | | | | | | Added a Win32/Win64 compliant implementation of vasprintf * debug.c - C. Watford (christopher dot watford at gmail dot com) Removed usage of vsyslog on Win32/Win64 systems, needs to be handled by a configure script * json_object.c - C. Watford (christopher dot watford at gmail dot com) Added scope operator to wrap usage of json_object_object_foreach, this needs to be rethought to be more ANSI C friendly * json_object.h - C. Watford (christopher dot watford at gmail dot com) Added Microsoft C friendly version of json_object_object_foreach * json_tokener.c - C. Watford (christopher dot watford at gmail dot com) Added a Win32/Win64 compliant implementation of strndup * json_util.c - C. Watford (christopher dot watford at gmail dot com) Added cast and mask to suffice size_t v. unsigned int conversion correctness * json_tokener.c - sign reversal issue on error info for nested object parse spotted by Johan Bj�rklund (johbjo09 at kth.se) * json_object.c - escape " in json_escape_str * Change to automake and libtool to build shared and static library Michael Clark <michael@metaparadigm.com> git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@4 327403b1-1117-474d-bef2-5cb71233fd97
* import of version 0.1Michael Clark2007-03-131-0/+493
git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@2 327403b1-1117-474d-bef2-5cb71233fd97