Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I've been trying to extract JSON fields from my tMongoDBInput (documents from a mongo collection) using a tExtractJSONFields component, but I'm unable to use it.
Logging the output shows :
A JSONObject text must begin with '{' at character 1 of Document{{code=P2.IB.LET, category=PROSECUTION}}
My JSON (document) from mongo looks like this:
{ "_id" : { "code" : "P2.IB.LET", "category" : "PROSECUTION" }, "value" : 1 }
{ "_id" : { "code" : "P2.FILECOPY", "category" : "PROSECUTION" }, "value" : 3 }
{ "_id" : { "code" : "SRNT", "category" : "FAI Request" }, "value" : 1 }
{ "_id" : { "code" : "P.399", "category" : "PROSECUTION" }, "value" : 1 }
{ "_id" : { "code" : "REIS.REVFORM", "category" : "PROSECUTION" }, "value" : 4 }
I've attached screenshots of my settings and the output as well.
I've tried using Json path as well as Xpath giving similar output (json path just gives a blank output).
I need to use tExtractJSONFields for a few other use cases as well, so it's really important that I can get this working.
Any help would be greatly appreciated.
Thanks!
I resolved the issue.
The problem was with the mongo driver version I used in Talend.
I changed the DB version setting in tMongoDBConnection from 3.5.X to 3.2.X and it's working fine now.
Just for note, my MongoDB version is 3.6.2.
I have read the Json file with JsonPath using tFileInputJson.
what are you giving in Loop Jsonpath query ,in tExtractJSONFields?
I was giving "$" as json looppath query.
It's working fine now, the settings/parameters were all fine. I'm posting the answer.
I resolved the issue.
The problem was with the mongo driver version I used in Talend.
I changed the DB version setting in tMongoDBConnection from 3.5.X to 3.2.X and it's working fine now.
Just for note, my MongoDB version is 3.6.2.
thanks