[英]How do I use simplejson to decode JSON responses to python objects?
使用simpleJSON的JSON序列化Python
如何創建對象,以便我們可以優化對象的序列化
我正在使用simpleJSON
1,2是固定變量
3是類別和分數的固定格
4是長度固定的字典數組(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'
}
]
],
}
嗯...
import simplejson as json
result_object = json.loads(input_json_string)
?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.