google / google/python-fire

How can I get json param

Open
#297 1 comment 0 reactions 0 assignees View on GitHub
question
Dominant language
Python
Stars
28.2k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

`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]}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.