DRY up as_json methods