我正在从S3中的存储桶内容加载数组,但是当我加载数组并使用以下代码打印字符串时:
for obj_array in bucket_array.objects.all():
json_array = obj_array.get()['Body'].read()
每个值的开头都有u
字符,如下所示:
{
u'values': [{
u'sensor': u'2',
u'temperature': u'24.5',
u'unit': u 'celsius',
u'datetime': u'23-02-2017 21:03:50'
}, {
u'sensor': u'2',
u'temperature': u'24.5',
u'unit': u'celsius',
u'datetime': u'24-02-2017 4:00:36'
}]
}
所以,当我尝试array_data = json.loads(json_array)
时,它会抛出以下错误:
Expecting property name: line 1 column 2 (char 1): ValueError
Any ideas how to solve this?