Load JSON file in HIVE

Hi,
I’m working to load json data into hdfs using HIVE.
Below is the data and code i tried, i couldnt able to add jar.
JSON data:
{“world_rank”: 1,“country”: “China”,“population”: 1388232694,“World”: 0.185},
{“world_rank”: 2,“country”: “India”,“population”: 1342512706,“World”: 0.179},
{“world_rank”: 3,“country”: “U.S.”,“population”: 326474013,“World”: 0.043},
{“world_rank”: 4,“country”: “Indonesia”,“population”: 263510146,“World”: 0.035}

DDL :
CREATE TABLE world_population (
world_rank INT,
country STRING,
population BIGINT,
world DOUBLE
)
ROW FORMAT SERDE ‘org.apache.hadoop.hive.serde2.JsonSerDe’
STORED AS TEXTFILE;

Below is the error while creating the table with JSONSerDe
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. Cannot validate serde: org.apache.hadoop.hive.serde2.JsonSerDe

Can anyone help me to resolve this issue.
I hope if jar file is added this can be solved.

Hi @Janaki_K,

Once try with this jar file- 'org.apache.hive.hcatalog.data.JsonSerDe’

ROW FORMAT SERDE 'org.apache.hive.hcatalog.data.JsonSerDe'
STORED AS TEXTFILE
LOCATION 'your hdfs location';

to which location jar-file 'org.apache.hive.hcatalog.data.JsonSerDe’ is to be added in itversity lab?

Hi @Janaki_K,

There is no need to give fully qualified path of jar file. you can mention just jar file name.!

please go through below code snippet-

CREATE TABLE world_population ( world_rank INT,
 country STRING,
 population BIGINT,
 world DOUBLE
 )
ROW FORMAT SERDE 'org.apache.hive.hcatalog.data.JsonSerDe'
LOCATION 'your hdfs location where you want to store';

LOAD DATA LOCAL INPATH 'json_file path' INTO TABLE world_population;

Hope this helps you
Thanks for your patient.