Forum Discussion

krogold's avatar
krogold
Regular Contributor
6 years ago

problems of step return inconsistency

Hello, I have a strange problem with my step result processing. I have a step ("get all devices") that can return a list of devices. the result is always ["item1", "item2, ...] etc, even if I hav...
  • krogold's avatar
    6 years ago

    I found a workaround, though I really would like to know why this happens.

    Here is the workaround :

     

    if (items_list.tokenize('[,]').size() == 1)
    {
        items_list = groovy.json.JsonOutput.toJson(items_list.tokenize('[,]'))
    }
    
    items_list = jsonSlurper.parseText(items_list)

    [item1] becomes ["item1"] and can be parsed properly