Json 為純數據,簡單來說,Json現階段沒有標準註解,但沒有註解實在很不方便,所以可以用偷吃步的方式,一樣以 Key:Value 的方式呈現資料,取個像註解的Key用雙斜線開頭而Value 就是註解的文字,用以讓程式碼忽略這個資料
這種方式註解看起來像這樣:
{
"//_comment": "註解文字..."
}
註解在資料裡的樣子:
{
"//_comment": "comment text goes here...",
"glossary": {
"title": "example glossary",
"GlossDiv": {
"title": "S",
"GlossList": {
"GlossEntry": {
"ID": "SGML",
"SortAs": "SGML",
"GlossTerm": "Standard Generalized Markup Language",
"Acronym": "SGML",
"Abbrev": "ISO 8879:1986",
"GlossDef": {
"para": "A meta-markup language, used to create markup languages such as DocBook.",
"GlossSeeAlso": ["GML", "XML"]
},
"GlossSee": "markup"
}
}
}
}
}
https://stackoverflow.com/a/244858