I am trying to pass a dictionary (loaded from JSON file) to format string. While single key-value unpack works correctly, I am not sure how I can access the nested keys (children) with a format string.
Or is there any other better way to pass JSON to string format?
config = {
"TEST": "TEST",
"TEST1": "TEST1",
"TEST2": {
"TEST21": "TEST21"
}
}
query_1 = """
{TEST} {TEST1}
"""
query_2 = """
{TEST} {TEST1}
{TEST2.TEST21}
"""
print(query_1.format( **config )) # WORKING
print(query_2.format( **config )) # NOT WORKING