Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Can someone help
So you can read Data as key first : it will extract :
{\"Id\":\"101\",\"Name\":\"AAA\"}
then you use in a tJavaRow or tMap : StringUtils.replaceAll((your string), "\\\\\"","\"") on the extract
and after you can use an other textractjsonfield on the result
Loop Jsonpath query : "$"
Mapping :
Column Json query
Id "Id"
Name "Name"
Hi could you be more precise , wich one do you want to remove?
Send me Love and Kudos
@guenneguez jeremy My json file has a / before each " ,I am not able to parse the values properly due to this.Is it possible to read the file with this extra \.
Data example:
[{Data:"{\"Id\":\"101\",\"Name\":\"AAA\"}"}]
If I read the file as it is in talend my output is
Data as key and the whole part as values {\"Id\":\"101\",\"Name\":\"AAA\"}
While I want to read ID as key and 101 as value,to me the only possible option seems to be removing the \ ,but that is causing json format issue.
Is it possible to read the data properly without removing the \.
Hi , you have to replace \" by " so :
you can read your json as a string with a tFileInputRaw, it will create an object type,
you convert it to a String with a tConvertType,
in a tJavaRow or tMap : StringUtils.replaceAll((your string), "\\\\\"","\"")
then you can write it on a tfileoutputRaw.
Finally you can read the new file and extract json,
input :
[{Data:"{\"Id\":\"101\",\"Name\":\"AAA\"}"}]
output :
[{Data:"{"Id":"101","Name":"AAA"}"}]
but your json is not valid
it should be :
[{"Data":{"Id":"101","Name":"AAA"}}]
Send me LOve and Kudos
So you can read Data as key first : it will extract :
{\"Id\":\"101\",\"Name\":\"AAA\"}
then you use in a tJavaRow or tMap : StringUtils.replaceAll((your string), "\\\\\"","\"") on the extract
and after you can use an other textractjsonfield on the result
Loop Jsonpath query : "$"
Mapping :
Column Json query
Id "Id"
Name "Name"
@guenneguez jeremy Thanks!