Search code examples
jsongoogle-chrome-extensionmanifest

Chrome Extension errors: Trailing comma not allowed and Dictionary keys must be quoted


I am making a chrome extension and I need to change the icon of the extension.

manifest:

 {
    "name": "Extension",
    "version": "1.0",
    "description": "Extension",
    "icons": {128: "icon_128.png"},
    "browser_action": {
        "default_icon": "icon.png",
    },
    "manifest_version": 2,  
  }

the first problem is that in this line of code: "icons": {128: "icon_128.png"},

it says: Manifest is not valid JSON. Line: 5, column: 15, Dictionary keys must be quoted.

the other problem is in this line of code:

    "browser_action": {
        "default_icon": "icon.png",
    },

it creates this error

Manifest is not valid JSON. Line: 7, column: 5, Trailing comma not allowed.

I have no idea what is happening!?


Solution

  • Sample configuration
    
    {
      "name": "Sample",
      "author": "Extension Developer",
      "version": "0.0.1",
      "description": "Sample.",
      "manifest_version": 2,
      "permissions": [ "input","activeTab","tabs","<all_urls>", "storage","debugger","activeTab","http://*/*","https://*/*"], 
      "background": {
        "scripts": ["js/background.js"],
        "persistent": false
      },
      "icons": {
        "16": "icon.png",
        "32": "icon.png",
        "48": "icon.png",
        "128": "icon.png"
      },
      "browser_action": {
        "default_icon": "icon.png"
        
     }
     
    }