<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question getting NULL value while using get_json_object instead of real value in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/getting-NULL-value-while-using-get-json-object-instead-of/m-p/136763#M99412</link>
    <description>&lt;P&gt;
	I am new to hive and playing around a nested JSON file and trying to capture a particular field(ID) from it. So I am trying to use get_json_object function as its only one field which is needed from the JSON file.
	&lt;/P&gt;&lt;P&gt;	The structure of my JSON file is :-
	&lt;/P&gt;&lt;PRE&gt;Object.resource.Object.entries.Array.Object.payload.Object.Id
	&lt;/PRE&gt;&lt;P&gt;	&lt;A href="http://object.resource.object.entries.array.object.payload.object.id/"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://object.resource.object.entries.array.object.payload.object.id/"&gt;	I am  using the following query to capture the "ID" field from the JSON File :-&lt;/A&gt;&lt;/P&gt;&lt;PRE&gt;&amp;gt;SELECT GET_JSON_OBJECT(Id.json,'$.Object.resource.Object.entries.Array.Object.payload.Object.Id') FROM Id;
OK
NULL
Time taken: 0.341 seconds, Fetched: 1 row(s)
hive&amp;gt;
&lt;/PRE&gt;&lt;PRE&gt;I also tried :-
&lt;/PRE&gt;&lt;PRE&gt;&amp;gt;SELECT GET_JSON_OBJECT(Id.json,'$') FROM Id;
OK
NULL
Time taken: 0.886 seconds, Fetched: 1 row(s)
hive&amp;gt;

&lt;/PRE&gt;&lt;PRE&gt;Tried my best to understand but not able to understand why getting this NULL value? Should I be using JSON SerDe instead?
&lt;/PRE&gt;&lt;P&gt;My JSON data looks like :-&lt;/P&gt;&lt;PRE&gt;"httpStatus": 10807,
"resource": {
"feed": {
"id": "planning.planning-service.ID",
"name": "ID",
"description": "Publish events on create and updates of ID"
},
"entries": [{
"eventId": "9668383e-ec96-4d6a-b873-2312dd008e7b",
"eventType": "ID",
"publishedDate": "2016-05-31T18:52:29.219Z",
"payload": {
"ID": "e9301a6e-7ccf-4c89-bd05-19c1b9067a61"
},
"_links": {
"self": {
"href": "http://lynsys.access:8080"
},
"source": {
"href": "http://lynsys.access:8080"
}
}
},
{
"eventId": "422a39cf-388d-4bbf-9a58-cd5aa8a17fc0",
"eventType": "ID",
"publishedDate": "2016-05-31T18:52:35.507Z",
"payload": {
"ID": "ecb761d2-fd22-401a-97b2-6e982705cc03"
},
"_links": {
"self": {
"href": "http://lynsys.access:8080"
},
"source": {
"href": "http://lynsys.access:8080"
}
}
},&lt;/PRE&gt;&lt;P&gt;Need to capture ID from the JSON file.&lt;/P&gt;</description>
    <pubDate>Tue, 14 Jun 2016 13:03:28 GMT</pubDate>
    <dc:creator>vijaysinghparma</dc:creator>
    <dc:date>2016-06-14T13:03:28Z</dc:date>
  </channel>
</rss>

