UNSOLVED Preferences Editor: "Error while parsing JSON"



  • For a while now, whenever I have tried saving a change to the Preferences Editor, I have received the following error:

    Error while parsing json.
    Invalied \escape: line 1 column 31640 (char 31639)
    

    57bf3daf-77b8-4a9f-b816-9b7a00e06f44-image.png

    I initially tried to see what the 31639th character was, and it was just the a in line 479, # Tangent Stroke Color. However, removing all commented lines didn’t solve this.

    What did did solve it was removing all of the strings from spaceCenterInputSamples. This makes sense, as there are a lot of \ escapes in there. However, I obviously want to keep those strings, but I am having trouble figuring out the exact culprit. I looked at each \, and I couldn’t see what might be wrong.

    Finally, I removed all commented lines, because those triggered errors in VS Code’s JSON formatter. Once I did that, VS Code pointed me to the instances where \' were saved in those strings.

    4cedbf51-861b-4b7c-81e0-97dffe4e5a39-image.png

    Removing the backslashes in front of single quotes fixed my problem.

    I’m posting this because:

    1. It helped me figure out and fix my immediate problem
    2. I figure others (or my future self) may have the same problem, and want to search for an answer
    3. Maybe there is something that could be done in RoboFont to prevent this error, such as not saving \' in spaceCenterInputSamples. Alternatively, the error message could be more helpful ... line 1 column 31640 is confusing. However, I’m not sure what would be involved in this, and I know there are lots of competing priorities, but I may not be the only person to face this issue.

    You can mark this as solved or leave it open if it’s something you want to take any action on. Thanks!


  • admin

    Improve error message available in the next beta!

    side note: json has no comments (which is in some cases really handy). The preference editor uses a custom slang where # comments are possible.



  • Shoot, so... actually, those backslashes single quotes get re-added each time I save, close, and reopen the JSON preferences. So, basically, each time I edit JSON prefs and save, I get this same error, and have to re-fix it. I guess I’ll change the single quote strings to use the glyph name /quotesingle instead of the Unicode.


Log in to reply