Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I need help please,
I need to know how I can extract this type of JSON :
"paymentData"
:"{\"cardno\":\"5017# # # # # # # # # # 00\",\"expDate\":\"202210\",\"walletId\":\"test\",\"paymentMeanId\":\"1\",\"replacedWallets\":[{\"cardno\":\"4990# # # # # # # # # # 34\",\"expDate\":\"201302\",\"walletId\":\"test\",\"paymentMeanId\":\"1\"}]}"
With tExtractJsonfields or Tjava , how I can do ?
Thanks Everyone
Hi,
"paymentData"
:
"{\"cardno\":\"5017# # # # # # # # # # 00\",\"expDate\":\"202210\",\"walletId\":\"test\",\"paymentMeanId\":\"1\",\"replacedWallets\":[{\"cardno\":\"4990# # # # # # # # # # 34\",\"expDate\":\"201302\",\"walletId\":\"test\",\"paymentMeanId\":\"1\"}]}"
is not a valid json
but
{
"paymentData": {
"cardno": "5017# # # # # # # # # # 00",
"expDate": "202210",
"walletId": "test",
"paymentMeanId": "1",
"replacedWallets": [
{
"cardno": "4990# # # # # # # # # # 34",
"expDate": "201302",
"walletId": "test",
"paymentMeanId": "1"
}
]
}
}
is a valid json you can surely parse it via tExtractJsonfields
If you want to parse :
"{\"cardno\":\"5017# # # # # # # # # # 00\",\"expDate\":\"202210\",\"walletId\":\"test\",\"paymentMeanId\":\"1\",\"replacedWallets\":[{\"cardno\":\"4990# # # # # # # # # # 34\",\"expDate\":\"201302\",\"walletId\":\"test\",\"paymentMeanId\":\"1\"}]}"
read it as a String then in a tjavarow by example :
String str = input_row.body.replaceAll("\\\\","");
output_row.body = str.substring(1, str.length() - 1);;
it will suppress all the \ and the first and last ".
then you could parse it via tExtractJSONFields with a String type
Send me Love and Kudos