1

My android game pushes this JSON to my django server:

{
data: [
    [
        Settings,
        "4748"
    ]
],
logType: starcycle-screenchanges
}

It's not valid though because it doesn't have the strings. Which, I think, is why I can't insert it into mongoDB. Is there an easy way to make it so I can make it a json with json.loads().

I can't use eval()

4

1 回答 1

1

您的数据似乎是有效的YAML(它是 JSON 的超集),因此您可以使用PyYAML

>>> import yaml
>>> yaml.load(data)
{'data': [['Settings', '4748']], 'logType': 'starcycle-screenchanges'}
于 2013-04-11T07:46:53.743 回答