Skip to content

Latest commit

 

History

History
35 lines (22 loc) · 585 Bytes

File metadata and controls

35 lines (22 loc) · 585 Bytes

JSONDecodeError: Extra data

Occurs when multiple JSON objects are placed in a single string without proper structure.

Reproduce

import json

data = '{"name": "john"} {"age": 30}'

result = json.loads(data)
print(result)

Error Message

json.decoder.JSONDecodeError: Extra data: line 1 column 18 (char 17)

Fix

import json

data = '[{"name": "john"}, {"age": 30}]'

result = json.loads(data)
print(result)

Reflection

Tried to load multiple JSON objects at once, but JSON requires a single valid structure like an array or object.