High-Speed Rail

High-Speed Rail

21.4k Downloads

[Bug] Crash on startup when `json5` config file has trailing commas

CarlMichaelFabe opened this issue ยท 3 comments

commented

Found this by using VSCode to edit the config file, which automatically puts trailing commas when formatting.

commented

I added a clarifying comment to the file:

// NOTE: This is not actually json5 - it's parsed with minecraft's built-in json parser but with
// some preprocessing to allow for '//' -style comments like this one.  The lie in the .json5 
// extension just helps text editors deal with it.
commented

trailing commas aren't allowed in json. the parser (not my code) is just following the spec

https://www.json.org/json-en.html

whatever vscode plugin you have is doing it wrong

commented

You are using json5 though.
It also has a spec. https://spec.json5.org/
And it allows trailing commas. Maybe there's a different parser for it.