It would seem that that the value is an array, but I’m not sure it needs to be parsed as I can’t see quotes around the console logged element. It’s not a string that needs to be parsed.
Looking at this more closely.
The JavaScript find function returns an array. collVar will be an array, however the test is looking for the “value” element under that array, which could be a string that needs to be parsed, but appears that its just another array.
It’s already an array, and you should be able to work directly with the elements.
The ‘collection’ variable is already parsed right at the top of the tests tab, so I don’t understand why it would need to be done again for any of the elements.
I hate it when I see array elements within JSON stored as string, because why on earth would you want to do this, as its then difficult to work directly with the elements.
let collection = pm.response.json().collection
The entire response has been parsed at this point.
In the cloned submit request, can you just remove the JSON.parse from the following line. (The pm.expect line).
If this does work, then it sounds like a problem with the submit request and one for Postman to check.
If you were accessing the actual collection variable directly, then you would need to parse it, as its stored as a string at that point. But this code is not actually working directly with the collection variable, but the “collection code” returned by the Postman API. It’s not quite the same. The find function will return an array, and does not need to be parsed further. It would appear that the “value” element which the test is checking is also an array, which doesn’t need to be parsed again.
You can check this by console logging the colvar variable on its own, and expand the elements and check that “value” is an array, and not a string. If you can expand the element, its an array. You won’t be able to expand it properly if its a string.
It would be nice to know if anyone else doing this challenge recently is having the same issue? As I would expect this to affect everyone.