Open mlqn opened 1 month ago
We could skip comments during parsing to avoid Studio crashing. This will almost definitely result in a lot of questions as to why Studio is removing comments from json files though. App-lib code can do this, because they do not modify the files, but in Studio any change that causes f.ex. a layout-file with comments to update will then remove the comments.
The JSON specification does not allow for comments, as JSON is data only.
I guess our options are:
Studio needs to add back the comments, just the same as it needs to add back the formatting when saving.
Description
Studio crashes if one of the JSON files contains a comment, an issue that has already been reported by some users.
https://github.com/Altinn/altinn-studio/assets/24462611/e6ed9013-1d23-4b3d-a53f-3d6d3d8094df
A solution proposed by @ivarne, already used by Team Apps, is to improve UX by supporting comments and skipping them during parsing using
JsonCommentHandling.Skip
.We should also consider improving our error handling to give a more specific error message to users when a parsing issue occurs.
Additional Information
No response