| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
When parsing a JSON node we need to correctly set up the parent node
of the newly created ones.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
JSON is an object serialisation format (thanks, RFC4627), so it can
only express objects and/or arrays as top-levels.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
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.
|