I have to compare two JSON arrays, one has the value as ["123.45"] and the other has value [" 123.45"] How to iterate and remove the spaces? The 2nd array value has spaces before the actual value.
Asked
Active
Viewed 1,362 times
1 Answers
0
Use karate.map()
for transforms: https://github.com/intuit/karate#json-transforms
* def before = [" 123.45 "]
* def fun = function(x){ return x.trim() }
* def after = karate.map(before, fun)
* match after == ['123.45']

Peter Thomas
- 54,465
- 21
- 84
- 248