python-fire
python-fire copied to clipboard
How can I get json param
test.py
import fire
def hello(name):
print(name)
print(name.get('a'))
if __name__ == "__main__":
fire.Fire(hello)
example:
python test.py '{"a":"aaa","b":[1,2,3]}'
the param name is json dict, result print:
{'a':'aaa','b':[1,2,3]}
'aaa'
but when input:
python test.py '{"a":"aa.a","b":[1,2,3]}'
the param name can't parse to json, it's a str,how can I get the json param??
{a:aa.a,b:[1,2,3]}
environment: win10 64bit python3.6 32bit fire 0.3.1
linux centos8 not found this problem!