cockpit: Fix problems with JSON generation and parsing

Fix various issues with JSON generation that are present in upstream
json-glib:

https://bugzilla.gnome.org/show_bug.cgi?id=727593
https://bugzilla.gnome.org/show_bug.cgi?id=728951

In addition clean up our JSON parsing and generation API so we don't
have to constantly carry around JsonGenerator and JsonParser objects.

Fixes #413
daemon: Remove workarounds for lousy JSON encoding

json-glib had a generator bug, and we do our own generation now.
So remove the hacks necessary to work around json-glib.