google / google/python-fire

How can I get json param

Aperta
#297 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
question
Lingua principale
Python
Stelle
28.2k
Fork
1.5k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.