summaryrefslogtreecommitdiff
path: root/json.h
AgeCommit message (Collapse)Author
2010-08-10Added explicit NULL and '\0' checks, and documented more functions/structures.Joey Adams
2010-08-06Added more comments to json.c / json.h and cleaned it up a bit.Joey Adams
Also made json_delete a little less confusing (but it still uses gotos).
2010-08-05Renamed json_node to JSON in the C code.Joey Adams
2010-08-05Added license comments to source files and ran pgindentJoey Adams
2010-08-05Switched all error reporting from elog to ereport.Joey Adams
2010-08-04Made JSON datatype well-behaved with respect to character sets.Joey Adams
Note that this is currently untested with server encodings other than UTF-8. The encoding policy used is: JSON nodes and most of the JSON functions still operate in UTF-8. Strings are converted between server encoding and UTF-8 when they go in and out of varlena (text*), and a set of helper functions are implemented to make these conversions simple to apply. It is done this way because converting individual codepoints to/from whatever the server encoding may be is nontrivial (possibly requires a loaded module). The JSON code needs to encode/decode codepoints when it deals with escapes. Although a more clever and efficient solution might be to defer charset conversions to when they're necessary (e.g. round up all the escapes and encode them all at once), this is not simple, and it's probably not much more efficient, either. Conversions to/from server encoding and UTF-8 are no-ops when the server encoding is UTF-8, anyway.
2010-07-24* Migrated my Unicode functions to util.c and made them rely more onJoey Adams
PostgreSQL's pg_wchar.h routines. * Touched up various functions' documentation. json_node's are currently encoded in UTF-8, and the JSON module is not 100% compatible with arbitrary server encodings yet. I plan to switch from UTF-8 to the server encoding pretty soon, after which JSON should be a well-behaved datatype as far as charsets go.
2010-07-24* Removed the string buffer code in json.c and used StringInfo instead.Joey Adams
* Removed json_cleanup and json_validate_liberal. json_cleanup was badly in need of a rewrite.
2010-07-23Ran pg_indent and made a few purely cosmetic changes (before running ↵Joey Adams
pg_indent again).
2010-07-22* Added json_set(json, json_path text, json) function.Joey Adams
* Reworked json_node::orig so it can handle replacing the key or value without altering surrounding formatting. * json_encode (C function) is now recursive (its stack usage depends on the depth of input). This was done because json_encode cannot rely on nodes' ->parent fields being trustworthy, as json_replace_value assigns JSON nodes by reference.
2010-07-06* Added json_getJoey Adams
* Affirmed (with a trivial test) that json_path returns its results breadth-first
2010-06-21* Made it so json_path preserves original text.Joey Adams
* Removed the global variable json_escape_unicode and added a parameter for it to the json_encode and json_encode_string C functions.
2010-06-17* Added json_validate(text) function.Joey Adams
* Migrated test strings from json-0.0.2 * Added struct {...} orig; field to struct json_node, but it's not used yet. It will be used to hold pointers to original text.
2010-06-14Implemented/tested parser for basic JSONPath(ish) patterns.Joey Adams
2010-06-09Moved everything in /contrib/json along with json.sgml to root directory.Joey Adams
This repository should probably be an honest-to-goodness branch of mainline PostgreSQL. I'm looking into that :-)