Godot Version
4.4
Question
I am using a JSON file for some data in my game, but there are a few times I made a mistake in JSON such as forgetting a comma, etc. But then in the terminal, I just see
ERROR: Parse JSON failed. Error at line xx: Expected '}' or ','
but the game just keeps on running and the dictionary that supposed to get data from the json is empty, and I have been hunting down what went wrong for 2 times now. I do not want it to happen again, so right now, I have this:
var result : Variant = JSON.parse_string(content)
if not typeof(result) == TYPE_DICTIONARY:
push_error("Invalid JSON format from file!")
For the above, I got the error in my console but this error got pushed way up by various other prints.
What another function must I use in order to make the engine stop working and blatantly yell right at me that the JSON in the file is invalid?