Reading from json files with a trailing new line causes an "Unexpected character" runtime.
Numbered Steps to Reproduce Problem:
1. Compile applicable code with the json file in the indicated folder
2. Click the 'test json' verb
Code Snippet (if applicable) to Reproduce Problem:
The first causes no issues wheras the second throws the runtime when trying to read it.
{
"test": "test ok"
}
{
"test": "test ok"
}
//This comment is just whitespace in the actual file
/mob/verb/test_json()
var/json_file = file("data/json/test.json")
var/list/json = json_decode(file2text(json_file))
usr << "[json["test"]]"
Expected Results:
"test ok" Should be visible to the mob using the verb
Actual Results:
Nothing visible and an unexpected character runtime.
Does the problem occur:
Every time?
Yes
In other games?
Yes
In other user accounts?
Yes
On other computers?
Yes
When does the problem NOT occur?
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked?
511 At least
Workarounds:
Remove the trailing newline from json files