JsonQt now has QVariantMap -> JSON
(posted by Fred Emmott at 2008-11-05 14:25:40)
As of a few days ago, JsonQt can translate both ways between QVariantMap objects and JSON strings (see the tests for examples). Someone sent a link to QJson my way; after a quick look, here's a couple of advantages and disadvantages of each:
- JsonQt doesn't depend on bison, Boost::Spirit, or anything except a compiler, cmake, and Qt - easier for windows builds, and means I don't have to worry about syntax changes between one version of $parserGenerator to the next.
- QJson is written using bison - if bison's your thing, this can make it easier to fix errors.
- QJson can handle the top-level JSON "thing" being an array, not an object - JsonQt requires it to be an object.
- JsonQt provides both translation both ways
The last point I think is due to me misreading json.org - though it's easy enough to change (make it so that the main public functions take/return QVariants instead of QVariantMaps, and if trying to parse as an object fails, try to parse as an array).
Update: QJson has the bison-generated files in SVN, in addition to the bison source files.
Trackbacks
No trackbacks for this post










