Hi Guys
i'm getting an unrecognized error while using json files.
Error message:
E 0:00:05.602 parse: Error parsing JSON at line 37: Expected 'EOF'
Here is my original json file: https://pastebin.com/8vBaJpeY
Was verified using jsonlint.com and is OK.
And here is my code:
func updateDB(pos,item,new_item_id = null):
if new_item_id != int(item.name.left(5)):
var equipSlotData = {}
var equipSlotData_file = File.new()
equipSlotData_file.open("res://DBFiles/EquipSlotDB.json",File.READ_WRITE)
var equipSlotData_file_json = JSON.parse(equipSlotData_file.get_as_text())
equipSlotData = equipSlotData_file_json.result
var slot = get_slot_under_pos(pos)
if new_item_id == 0:
equipSlotData[prev_slot.name]["ItemID"] = new_item_id
else:
equipSlotData[slot.name]["ItemID"] = int(item.name.left(5))
prev_slot = slot.name
equipSlotData_file.store_string(JSON.print(equipSlotData, "\t"))
equipSlotData_file.close()
EquipSlotDB.update_equipslot_db()
The error seems to happen in that part:
if new_item_id == 0:
equipSlotData[prev_slot.name]["ItemID"] = new_item_id
Before that code condition GODOT changes my json format to a invalid format inserting two '}' in the end of my json file. (see below)
Here the corrupted json file with two '}' inserted by godot
CorruptedJSON
I dont know why this happen, can you plz help me?
Thx!