gd: Fix documentation comment
UNFINISHED more work on tidying up JSON parsing/generation

Tests almost pass. Just need to fix extra_json.