remove trailing comma
add explicit .toJSON() calls to ctx.toJSON()