How do I run Athena queries for pretty-print JSON files?
"When I run Amazon Athena queries on pretty-print JSON files with JSON SerDe, my queries fail with the following error message: "HIVE_CURSOR_ERROR: Row is not a valid JSON Object"."
"When I run Amazon Athena queries on pretty-print JSON files with JSON SerDe, my queries fail with the following error message: "HIVE_CURSOR_ERROR: Row is not a valid JSON Object".ResolutionAthena JSON SerDe doesn't support pretty-print JSON files, such as the following file:{    "id": "b179db57-9d5b-40c8-8f07-f75bd1fa1b3c",    "random_number": 19,    "categoires": [        "category 1",        "category 2"    ],    "dict": {        "name": "category 1",        "comment": "category 2"    }}{    "id": "bc4624ce-d752-4e38-8a30-42de158dbc50",    "random_number": 95,    "categoires": [        "category 1",        "category 2",        "category 3",        "category 4"    ],    "dict": {        "name": "category 2",        "comment": "category 1"    }}{    "id": "1d3298e8-e3bb-41c0-950c-6a146555ce3c",    "random_number": 89,    "categoires": [        "category 1"    ],    "dict": {        "name": "category 5",        "comment": "category 3"    }}Because Amazon Ion is a superset of JSON, use the Amazon Ion Hive SerDe to query non-Amazon Ion JSON datasets. Unlike other JSON SerDe libraries, the Amazon Ion SerDe doesn't expect each row of data to be on a single line. Use this feature to query JSON datasets that are in pretty print format, or break up the fields in a row with newline characters.1.    Create a table that's similar to the following one with Athena Ion Hive SerDe:CREATE EXTERNAL TABLE table_name (    id string,    random_number int,    categories array<string>,    dict struct<name:string, comment:string>)STORED AS IONLOCATION 's3://sample-bucket/prefix/'2.    Query the table:SELECT * FROM table_nameThe output looks similar to the following output:#idrandom_numbercategoriesdict1b179db57-9d5b-40c8-8f07-f75bd1fa1b3c19[category 1, category 2]{name=category 1, comment=category 2}2bc4624ce-d752-4e38-8a30-42de158dbc5095[category 1, category 2, category 3, category 4]{name=category 2, comment=category 1}31d3298e8-e3bb-41c0-950c-6a146555ce3c89[category 1]{name=category 5, comment=category 3}Related informationWhy do I get errors when I try to read JSON data in Amazon Athena?Follow"