google / google/python-fire

How can I get json param

Aberta
#297 1 comentário 0 reações 0 responsáveis Ver no GitHub
question
Linguagem predominante
Python
Estrelas
28.2k
Forks
1.5k
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

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

Guia de contribuição

Abrir o guia de contribuição

Direção de pesquisa

Start with the test.py example and run both command lines shown in the issue to reproduce the differing argument parsing. Read the Python Fire argument-parsing path involved, then determine whether dotted JSON values should remain a dictionary; done requires either a confirmed fix with a regression test or a clear documented limitation.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
json, python
Domínio
cli
Tipo de issue
Bug
Dificuldade
3/5
Tempo estimado
1-2 dias
Status de atividade
Estagnada
Clareza
Precisa de esclarecimento
Facilidade para iniciantes
25/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.