skip to Main Content

Debian – Convert text file that contains colon to json

Existing Code import json filename = 'thunar-volman/debian/control' dict1 = {} with open(filename) as fh: for line in fh: print(line) command, description = line.strip().split(': ') print(command) print(description) dict1[command.strip()] = description.strip() with open("test.json", "w") as out_file: json.dump(dict1, out_file, indent=4, sort_keys = False)…

VIEW QUESTION

Filter json query complex nested list

I have the following: { "additionalInfo": [], "id": "8d929134-0c71-48d9-baba-28fb5eab92f2", "instanceTenantId": "62f4c8ab6a041c1c090f7994", "name": "Global", "siteHierarchy": "8d929134-0c71-48d9-baba-28fb5eab92f2", "siteNameHierarchy": "Global" }, { "additionalInfo": [ { "attributes": { "addressInheritedFrom": "0d5e4dc7-ce4e-4aff-bf9f-bb8242797dce", "type": "area" }, "nameSpace": "Location" } ], "id": "1720c283-a903-43f9-996e-a25d63409d69", "instanceTenantId": "62f4c8ab6a041c1c090f7994", "name": "SOUTH SOUTH",…

VIEW QUESTION
Back To Top
Search