skip to Main Content

How to add sub item to json in for loop

I am trying to achieve the following json output: My current code: #!/usr/bin/env python3.9 import json complete_lst = [] url_lst = ['https://', 'https://', 'https://'] complete_lst.append({'title': 'Hello'}) for url in url_lst: complete_lst.append({'watch': {'Season1': {'url': url}} }) with open("Hello.json", "w") as file:…

VIEW QUESTION

Json – Ansible loop with array

Could someone let me know how we can create a code as below? - name: TEST1 set_fact: list_a: "{{ list_a + [item.json.SearchResult.resources] }}" with_items: - "{{ source_list.results[0] }}" - "{{ source_list.results[1] }}" - "{{ source_list.results[x] }}" ... (unknown how many…

VIEW QUESTION
Back To Top
Search