我对JSON比较陌生,我找不到我的错误

时间:2018-05-09 16:15:49

标签: json google-chrome

我试图在谷歌浏览器中创建自己的主题,所以我复制粘贴了一个JSON,只是更改了颜色的值等等,但是现在,我在RGB颜色列表中出现错误。我该如何解决这个问题?

{
   "name": "TMGS3 Flowers",
   "theme": {
      "colors": {
         "frame": [ 231, 250, 251 ],
         "tab_text": [ 241, 000, 148 ],
         "tab_background_text": [ 250, 194, 129 ],
         "bookmark_text": [ 241, 000, 148 ],
         "ntp_text": [ 241, 000, 148 ],
         "ntp_link": [ 244, 172, 168 ],
         "ntp_section_text": [ 241, 000, 148 ],
         "ntp_section_link": [ 244, 172, 168 ],
         "ntp_section": [ 185, 221, 141 ]
      },
      "images": {
         "theme_frame": "Images/theme_frame.png",
         "theme_ntp_background": "Images/theme_base.png",
         "theme_tab_background": "Images/theme_tabbg.png",
         "theme_toolbar": "Images/theme_toolbar.png"
      },
      "properties": {
         "ntp_background_alignment": "bottom",
         "ntp_background_repeat": "no-repeat",
         "ntp_logo_alternate": 1
      },
      "tints": {
         "buttons": [ 1, 1, 1 ]
      }
   },
   "version": "3"
}

3 个答案:

答案 0 :(得分:1)

问题在于您提供000的格式。由于他们是iIntegers,您需要使用0,否则JSON将无法验证。例:

"tab_text": [ 241, 0, 148 ]

如果您绝对需要使用此格式,请考虑将类型更改为字符串,如果它对您的用例有意义:

"tab_text": [ "241", "000", "148" ]

答案 1 :(得分:0)

JSON编号中不允许使用前导零(请参阅https://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf),因此您必须使用000替换0的每个实例。

答案 2 :(得分:0)

使用以下方法验证JSON:https://jsonformatter.curiousconcept.com/突出显示一个潜在问题,即000是无效数字。切换为使用0而不是这些数字使JSON有效。