got the loop to work and am now returning the value by iself. still need to figure out how to convert it to josn string