I want to export a JsMap (made with karate.merge
) as a json file, using karate.write
. My problem is that the file only consists of one line:
{"a":1,"b":2}
While I expect something like this (formatted over 4 lines):
{
"a":1,
"b":2
}
My code, with all the conversions I tried (which led to the same result):
Scenario: merge
* def foo = { a: 1 }
* def bar = karate.merge(foo, { b: 2 })
* match bar == { a: 1, b: 2 }
* karate.write(bar, 'bar1.json')
* karate.write(bar, 'bar2.txt')
* karate.write(karate.toJson(bar), 'bar3.json')
* karate.write(karate.toJson(bar), 'bar4.txt')
* string bar = bar
* karate.write(bar, 'bar5.json')
* karate.write(bar, 'bar6.txt')
* karate.write(karate.toJson(bar), 'bar7.json')
* karate.write(karate.toJson(bar), 'bar8.txt')
What would be the correct conversion to achieve my desired result?