On a json like the following
{
'a' : 'hello'
'b' : { 'c' : 'hello', 'd': 'hello2' }
}
I am unable to extract c and d because the component loops on b, if I specify json loop path to be "$.*"
and field to be extracted 'b'
.
What is the right way to configure the tExtractJsonFields for simple json extraction?
See my example below. I am using a tFileInputJSON
component rather than tExtractJSONFields
but they have the same properties available.
Diagram 1: json file. The only difference from yours is that I added a comma between the a and b fields, I am using double rather than single quotes, and I changed first value to hello_a. Otherwise it is the same as your example.
Diagram 2: input component. This is where the magic happens. You can see that I am using xPath
rather than JSONPath
(I have had better luck with it).
Diagram 3: this is the proof that all values were extracted.
You can also setup your json as metadata and experiment with it there. See diagram 4. This too shows that Talend can access all the data in the file, and will allow you to experiment with the file structure and path statements getting immediate results.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.