Just a little question. I am stuck on a little thing.
I would like to extract all the IP addresses and some information from a json
for exemple
IPaddress continentCode continentName countryCode
8.8.8.8 NA North America US
1.2.3.4 OC Oceania AU
…
but it doesnt work as expected.
Could you please help me?
Many thanks
Do you need to use Python for it? Looking at your code you are looping your items then setting str to your value and returning it on the first loop instead of appending to your array and returning it later.
for item in data:
for key, value in item.items():
result_list.append({
“IPaddress”: key,
“continentCode”: value.get(“continentCode”, “”),
“countryCode”: value.get(“countryCode”, “”),
“countryName”: value.get(“countryName”, “”)
})
# Now you can use the result_list as needed
return result_list
but one last thing how to collect the json from a previous node? in order to implement json_data =?
regarding the documentation :
Shorthand for _input.item.json. Incoming JSON data from a node. Refer to Data structure for information on item structure. Available when you set Mode to Run Once for Each Item.
but the following error occured
ERROR: TypeError(f’the JSON object must be str, bytes or bytearray, ’ TypeError: the JSON object must be str, bytes or bytearray, not JsProxy