Four Stars

MongoInput (Json) to Hive (text) using tExtractJSON giving an error.

Hi Experts,
I'm trying to load HIVE tables (text - Flat) format from MongoDB (JSON format). I have used tExtractJSONFields component, but getting an error "Error on line 1 of document  : The content of elements must consist of well-formed character data or markup. Nested exception: The content of elements must consist of well-formed character data or markup.". Searched talendforge forum for help, but didn't help much. 
Here is my mapping
tMongoInput --> tExtractJsonField ---> tlogRow --->tHDFSOutput ---> tHIVECreateTable ---> tHIVELoad
Any help is much appreciated.
Regards
cmadaka
2 REPLIES
Moderator

Re: MongoInput (Json) to Hive (text) using tExtractJSON giving an error.

Hi,
Did you check your json source file to see if it is well-formed (Json Validator JSONLint)?
How did you set your tExtractJsonField  component? Could you please also paste your json source file here(a sample content is OK)?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Four Stars

Re: MongoInput (Json) to Hive (text) using tExtractJSON giving an error.

Thanks Sabrina. tExtractJsonField was set-up using 
Read by : XPath and 
JSON Field : triggerFired, 
Loop XPath Query : ""
Here is the sample JSON record. If i remove the FiringDate field in the subdocument, job seems to run fine. other wise i get an error. Don't have any issue with insertDate and createtimestamp date field.
{
    "_id" : ObjectId("22349j3242394-234"),
    "insertDate" : ISODate("2014-06-30T04:00:00.000Z"),
    "Identifier" : "Raw Data",
    "status" : "Accepted",
    "userId" : "93837574849",
    "createdTimestamp" : ISODate("2015-07-10T22:01:44.000Z"),
    "triggerFired" :
}