Python json reported an error

ss=""data":[{"amount":"400","financeAmount":"400","financeAmountUnit":"CNY","financeDate":1514649600000,"newsUrl":"http://www.lieyunwang.com/archives/447914","participantVos":[{"entityId":117,"entityName":"","entityType":2,"investmentId":181676}],"phase":"ANGEL"}]"
sss=json.loads(ss)
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/decoder.py", line 342, in decode
    raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 1 column 7 (char 6


Oct.31,2021

take out the json in your ss and look at it alone.


import json

ss = """{"data":[{"amount":"400","financeAmount":"400","financeAmountUnit":"CNY","financeDate":1514649600000,"newsUrl":"http://www.lieyunwang.com/archives/447914","participantVos":[{"entityId":117,"entityName":"","entityType":2,"investmentId":181676}],"phase":"ANGEL"}]}"""

print(json.loads(ss))

the output is as follows

{'data': [{'amount': '400',
'financeAmount': '400',
'financeAmountUnit': 'CNY',
'financeDate': 1514649600000,
'newsUrl': 'http://www.lieyunwang.com/arc...',
'participantVos': [{'entityId': 117,

 'entityName': '',
 'entityType': 2,
 'investmentId': 181676}],
'phase': 'ANGEL'}]}

cause of error. Data is not used to start and end with {}. Json data must be placed in {}

Menu