Python component output incomplete

This is likely a total newbie question, as I’m a total newbie to python in general, so sorry in advance, but I’m stumped at the moment.

I brought in some data from a JSON file, which contained a few nested key:value pairs. All I’m trying to do is select parts of the data based on an input, and then send that selected data to separate outputs.

For some reason, when I use the .items() method to list both keys and values together, I can see all of them in the output window, but only one pair gets sent out of my desired output in the component. I’m attempting to send them out as strings joined by a comma, to be easily split later on. The problem is showcased by the “select car” component, and the desired output is shown by the “print keys and values” component.

Any help appreciated, and thanks!

cars-json.gh (13.8 KB)

image

on line 12 specifications is set to a new value each time the for loop loops over
what you may do is to initiate an empty list and start appending at each loop iteration

specifications = []
for k,v in specs.items():
    i = str(k)+','+str(v)
    specifications.append(i)
    print i

Ahhh, I see, thanks so much!!