John February 2016

Angularjs Translate with json fille comments

It is possible to use json comments to organize language files? I created a plunkr example with the error on browser console "SyntaxError: Unexpected token /"

 "HEADLINE": "Hello there!", /* COMMENT*/
 "LANG_DE_DE": "Lang: German", 
 "LANG_EN_US": "Lang: English"

plunkr example


Patrick Kelleter February 2016

since the file has to be valid JSON and JSON does not provide any comments in its syntax: No, you can not add comments there. It's against the specification of JSON, sorry.

Post Status

Asked in February 2016
Viewed 1,651 times
Voted 9
Answered 1 times


Leave an answer