Reputation: 137
I have a requirement where I want to print the character length of the values of all fields in JSON payload.
For example payload is:
{
"request": {
"tranRef": "1234",
"sender": {
"firstName": "Johnny",
"lastName": "Doe",
"address": {
"city": "Arlington",
"country": "USA"
},
"organizationName": "Unity"
},
"type": "Merchant"
}
}
it would print something like
tranRef >> 4
sender.firstName >> 6
sender.lastName >> 3
sender.address.city >> 9
sender.address.country >> 3
sender.organizationName >> 5
type >> 8
Upvotes: 1
Views: 490
Reputation: 58058
Not supported. Write your own Java interop code or you might be able to get somewhere with the JSON transforms: https://github.com/intuit/karate#json-transforms
Karate is a testing framework, not a general purpose programming language.
Upvotes: 2