1

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.

Kannan
  • 47
  • 3

1 Answers1

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