Loop step on json from ssh -> curl command

Hi,

I have a a problem that is almost identical to the one mentioned here from a couple of years ago. The difference is the json in my case is coming from a curl command rather than a REST call as far as i can tell.

The {{[“stepname”].[results].[stdout]}} output appears as follows:

{
	"items": [
		{
			"id": "fghfgh",
			"show": "this one"
		},
		{
			"id": "sdfewrf",
			"show": "that one"
		},
		{
			"id": "rhyjyteetgb",
			"show": "the other one"

		}

I’ve edited the output of the [results].[stdout] (which was originally a string) as below.

image

I’ve then added a loop step to loop around [“stepname”].[results].[stdout].[items] but am getting
an error in the log saying ‘repeat variable items wasn’t defined’.

Please could someone let me know what I’m getting wrong here? Presumably the error means I’m not defining something properly, but I’ve tried all sorts of variations and can’t work this out.

Thanks

You can’t change a string to an object by editing the outputs of a plugin. You can further define an objects output, but its not the same. What you most likely need to do is use the type converter plugin to convert the string to and object and there define the outputs according to what you expect so that you can loop over it.

Thanks Eric, and as simple as that, three hours of screaming and banging my head on the desk are a distant memory. All working great after converting the string output to an object first!