summaryrefslogtreecommitdiff
path: root/json-glib/json-parser.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Add JSON object parsingEmmanuele Bassi2007-10-011-15/+220
| | | | | | This commit completes the JsonParser class by adding the ability to parse JSON objects, either alone or inside arrays. JsonParser is now a JSON parser.
* Chain up nodes to their parentEmmanuele Bassi2007-10-011-1/+5
| | | | | When parsing a JSON node we need to correctly set up the parent node of the newly created ones.
* Add JsonNode, a generic container for JSON typesEmmanuele Bassi2007-10-011-23/+64
| | | | | | | | | | | | | | | | | This huge commit removes JsonData and adds JsonNode, the generic container for fundamental and complex data types extracted from a JSON stream. The contents of a JsonNode can be extracted from it in form of a GValue for fundamental types (integers, floats, strings, booleans) or in form of JsonObject and JsonArray objects. JsonObject and JsonArray now accept JsonNodes instead of GValues. The JsonParser object builds the data model tree when parsing a JSON stream; the tree can be recursed by getting the root node and walking it using the GValue API for the fundamental types and the objects/arrays API for complex types. The API has been updated and the tests now recurse through the generated data model tree.
* Skip the token check after parsing a nested arrayEmmanuele Bassi2007-09-211-0/+2
| | | | | | Since there cannot be any other token except for the comma, which we eat anyway, there's no point in going through the switch() check after we have finished parsing a nested array.
* Parse JSON arraysEmmanuele Bassi2007-09-211-17/+97
| | | | | | | Add the array parsing code. The parser identifies and builds nested levels of arrays, but the storage is not quite right. That is a problem of the parser object, though, so this can be considered a first raw pass at the problem.
* Top-levels in JSON can only be objects or arraysEmmanuele Bassi2007-09-211-10/+14
| | | | | JSON is an object serialisation format (thanks, RFC4627), so it can only express objects and/or arrays as top-levels.
* Add stubs to JsonParser for actually parsing a JSON streamEmmanuele Bassi2007-09-211-1/+265
| | | | | | | | | | | | | | | | | Initial commit for getting JsonParser to work. Because GScanner API is old and mostly sucks, we need to do some magic with signals. If json_parser_load_from_data() fails, the passed GError will be set with a JSON_PARSER_ERROR code and message; unfortunately, we can't get the nice error message out of GScanner. We can, however, override the default message handler and make it emit a signal on the JsonParser object. So, to make a long story short: the GError passed to the load_from_data() method is filled with a short error message; the *real* error message is passed to the ::error signal handlers so they can actually use it. GScanner should really get a way to retrieve the last error message.
* Initial import of JSON-GLibEmmanuele Bassi2007-09-201-0/+152
JSON-GLib is a JSON parser library written with GLib and GObject. JSON is the JavaScript Object Notation, and it's used to define objects and object hierarchies in a human-readable way.