Comments in JSON / RESJSON

Hi,

we try to figure out the way of introducing comments in JSON files that would be recognized as such by the parser and thus put in the "Comments" column in Passolo (2015).
We have tried to apply the solutions presented here:
producthelp.sdl.com/.../JSONAddin.htm
But we have encountered the following issues:
(1) Adding comments using double slashes works great, but as explained in the article, this results in having an invalid JSON file for the source content.
We are thinking of creating JSON files with comments, and then saving two copies of them: one containing comments - for translation purposes and another one with comments being automatically deleted for use as a regular JSON file with English content.
The problem is that it would just add some more complexity to a project that is already very complex.

(2) Converting the files to the resjson format works great as well, but it does not allow to have any nested elements.

Does someone know if there is some other way to put comments in JSON files, for them to go in the "Comments" column in Passolo while keeping valid JSON format of the source file? Or to process resjson files containing nested elements?

Thanks.
Piotr

Parents
  • Hello Piotr,

    I will log an enhancement request regarding an additional option to support the RESJSON commenting syntax in standard JSON file. I think this a much better approach than the actual very invasive option with the C-Style comments, making the JSON files invalid.

    Using the text file parser for JSON is quite challenging and can only be successful if you except limitations in the way how JSON is used. I don’t think that a JSON file that uses the complete syntax defined can be parsed without issues with the text file parser. The text file parser itself doesn’t support nested resource levels and I don’t think that this is an enhancement that will be implemented in the future. There are already existing parsers for structured file formats like JSON or XML which are supporting nested resource levels.
Reply
  • Hello Piotr,

    I will log an enhancement request regarding an additional option to support the RESJSON commenting syntax in standard JSON file. I think this a much better approach than the actual very invasive option with the C-Style comments, making the JSON files invalid.

    Using the text file parser for JSON is quite challenging and can only be successful if you except limitations in the way how JSON is used. I don’t think that a JSON file that uses the complete syntax defined can be parsed without issues with the text file parser. The text file parser itself doesn’t support nested resource levels and I don’t think that this is an enhancement that will be implemented in the future. There are already existing parsers for structured file formats like JSON or XML which are supporting nested resource levels.
Children