Skip to content

Instantly share code, notes, and snippets.

@amitkrout
Created February 22, 2022 04:56
Show Gist options
  • Select an option

  • Save amitkrout/b5ec9b029d880399bae168169e2402f1 to your computer and use it in GitHub Desktop.

Select an option

Save amitkrout/b5ec9b029d880399bae168169e2402f1 to your computer and use it in GitHub Desktop.
def getNewKeyValuePair(sourcekey):
with open("test1.json") as jsonFile:
data = json.load(jsonFile)
dict = {}
lst = []
dict[sourcekey] = {}
print("_______",list(data.keys()))
print("++++++++++++", len(data))
# rules_items_source = list(findkeysvalues(data, sourcekey))
rules_items_source = [["{{ 'PEP' | YYYYYYY | join }}"], ["{{ 'REP' | LLLLLL | join }}"]]
for i in rules_items_source:
print ("ssssssssssssssssss",rules_items_source)
print("kkkkkkkkkkkkkk",i)
x = re.findall("\w+", i[0])
print("bbbbbbbbbbbbbbbbbbb",x)
sourceItems = process_JSON_value("test.json", x[0], "compname")
print(sourceItems)
dict[sourcekey] = sourceItems
print("LLLLLLLLLLLLLLLLLL",dict)
lst.append(dict)
print(lst[0])
print(lst)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment