使用simpleJSON的JSON序列化Python
如何创建对象以便我们可以优化对象的序列化
我正在使用simpleJSON
1,2是固定变量
3是类别和分数的固定字典
图4是长度固定的dicts阵列(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'
}
]
],
}
Run Code Online (Sandbox Code Playgroud)
嗯...
import simplejson as json
result_object = json.loads(input_json_string)
Run Code Online (Sandbox Code Playgroud)
?
| 归档时间: |
|
| 查看次数: |
3970 次 |
| 最近记录: |