开发者

How do I use simplejson to decode JSON responses to python objects?

JSON serialization Python using simpleJSON

How do I create an object so that we can optimize the serialization o开发者_如何学运维f the object

I'm using simpleJSON

1,2 are fixed variables

3 is a fixed dict of category and score

4 is an array of dicts that are fixed in length (4), the array is a length specificed at run-time.

The process needs to be as fast as possible, so I'm not sure about the best solution.

    {
    "always-include": true,
    "geo": null,
    "category-score" : [
        {
            "Arts-Entertainment": 0.72,
            "Business": 0.03,
            "Computers-Internet": 0.08,
            "Gaming": 0.02,
            "Health": 0.02,
            
        } 
    ],
    "discovered-entities" : [
        {
            'relevance': '0.410652',
            'count': '2',
            'type': 'TelevisionStation',
            'text': 'Fox News' 
        },
        {
            'relevance': '0.396494',
            'count': '2',
            'type': 'Organization',
            'text': 'NBA' 
        } 
    ] 
],

}


Um...

import simplejson as json
result_object = json.loads(input_json_string)

?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜