Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
kuwaryogi27
Creator
Creator

tExtractJsonField gives null

Input json :

{

  "firstName": "John",

  "lastName": "Smith",

  "age": 25

}

tFileInputJson :

0693p00000BZFXVAA5.png

tExtractJsonField :

0693p00000BZFXzAAP.png

Result :

0693p00000BZFVPAA5.png

What mistake I am doing please can you let me know?

Labels (2)
3 Replies
prg
Employee
Employee

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.

 

0693p00000BZGa6AAH.png 

Revert back to the community if needed.

Please mark it as resolved if it helps. (Kudos also accepted) 🙂

 

Regards,

Vaishnavi

 

kuwaryogi27
Creator
Creator
Author

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.

Ravi_Rajagopal
Contributor III
Contributor III

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