Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Input json :
{
"firstName": "John",
"lastName": "Smith",
"age": 25
}
tFileInputJson :
tExtractJsonField :
Result :
What mistake I am doing please can you let me know?
Hello @Yogesh Kuwar ,
Please note that tExtractJSONFields extracts the desired data from incoming JSON fields based on the XPath or JSONPath query whereas tFileInputJSON extracts JSON data from a file, then transfers the data to a file, a database table, etc.
Here, I do not understand your requirement to use the tExtractJSONFields component. If you will use tfileInputJson only, you will be able to get your desired output.
Revert back to the community if needed.
Please mark it as resolved if it helps. (Kudos also accepted) 🙂
Regards,
Vaishnavi
Hello @Vaishnavi Khandelwal ,
Okay I got your point,, but above scenario is just an example to extract fields. Below is the realtime scenario can you please guide me for it then we can mark this as resolved (your guidance is very much appriciated) 🙂
We have to extract an ArrayList using tExtactJSONFields, below is the sourceJSON.
{
"content": [
{
"typeIds": [
"CL_Offersheet_ProcessCost",
"CL_OFFERSHEET_MOEMAX"
],
"id": "9c783501-20ee-4b04-ab09-6923e5ed0769",
"label": "Offer sheet M�max New",
"languageCode": "de_DE_AT",
"taxonomyIds": [
"TAX_KAT_OF_2",
"TAXm_DP_6"
]
}
]
}
Source File :
We need to extract the values from typeIds and taxonomyIds arrayList is it possible in tExtractJSONFields??
Kind regards,
Yogesh.
use the website http://jsonpath.com/ to see what your code would extract from the JSON file.
Copy paste the entire example which you gave above to the left hand side of the pane called Input.
in the JSON path syntax you would enter $.content[0].typeIds and on the right hand side it should yield the result
[
[
"CL_Offersheet_ProcessCost",
"CL_OFFERSHEET_MOEMAX"
]
]
Now in your Talend studio you will omit the $. and then enter "content[0].typeIds" on the Json Query
in the JSON path syntax you would enter $.content[0].taxonomyIds and on the right hand side it should yield the result
[
[
"TAX_KAT_OF_2",
"TAXm_DP_6"
]
]
Now in your Talend studio you will omit the $. and then enter "content[0].taxonomyIds" on the Json Query
Hope this helps !!
Good luck !!
Ravi Rajagopal