1
votes

I need to pass values from my features to json files. Ex: an item is created in the test feature and id is returned in response; I would like to put this id in a json file where I have something as: {"item": ["string1", string2 etc..] } to concatenate the id in string1, string2

I saw an example here but it didn't help me for json files: https://github.com/intuit/karate/blob/master/karate-junit4/src/test/java/com/intuit/karate/junit4/demos/type-conv.feature

Thanks for help

1

1 Answers

1
votes

Use the set keyword:

* def json = read('some.json')
* set json.item[] = 'string3'