summaryrefslogtreecommitdiff
path: root/jsonpath.c
AgeCommit message (Collapse)Author
2010-08-10Added explicit NULL and '\0' checks, and documented more functions/structures.Joey Adams
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-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* Migrated general-purpose functions to new files util.c/util.hJoey Adams
* A few various cleanups.
2010-07-23Ran pg_indent and made a few purely cosmetic changes (before running ↵Joey Adams
pg_indent again).
2010-07-23* JSONPath index subscript no longer extracts chars from strings.Joey Adams
* char() method added to JSONPath for extracting chars from strings. Although index subscripts (those using an integer) extract characters from strings in Stefan Goessner's JSONPath, and although it works that way in JavaScript, I believe it is rather illogical and unexpected in the context of JSONPath, and a poor use of the [] real estate. Because extracting characters from strings can still be useful, I have added a char() method for this. I implemented it now to prevent the supporting code for character extraction from wasting away.
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-14Refactored jsonpath a bit by introducing JPRef.Joey Adams
JPRef is a structure representing an item matched by jp_match. Before, plain old json_node was used, which couldn't distinguish between mutable references (actual JSON nodes from the original input) and immutable references (e.g. characters in a string). Yes, characters in a string are regarded as immutable because: * That's how it is in JavaScript. * It's easier to implement.
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-15Initial implementation of json_path function.Joey Adams
Currently, it re-encodes JSON nodes rather than preserving original text. This is subject to change.
2010-06-14Implemented/tested parser for basic JSONPath(ish) patterns.Joey Adams