0

simpleJSON を使用した JSON シリアライゼーション Python

オブジェクトのシリアル化を最適化できるようにオブジェクトを作成するにはどうすればよいですか

私はsimpleJSONを使用しています

1,2 は固定変数

3 はカテゴリとスコアの固定辞書です

4 は、長さが固定されている dict の配列 (4) です。配列は、実行時に指定された長さです。

プロセスはできるだけ速くする必要があるため、最善の解決策について確信が持てません。

    {
    "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' 
        } 
    ] 
],

}
4

1 に答える 1

5

うーん...

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

?

于 2010-10-30T22:32:00.660 に答える