keep getting this error: \"Manifest is not valid JSON. Line: 1, column: 1, Unexpected token.\" i don\'t understand what the issue is with my code? here is what i have so f
Please try to save the manifest.json file as UTF8 format.
The browser cannot find the manifest because the extension (MIME type). In Chrome DevTools > Network > Headers > Content-Type, the content-type of the manifest must match the actual manifest file extension (.json
or .webmanifest
). To resolve the 404 error, you need to declare the file type in web.config
:
<staticContent>
<mimeMap fileExtension=".json" mimeType="application/json" />
<mimeMap fileExtension=".webmanifest" mimeType="application/manifest+json" />
</staticContent>
This is old but I had the same issue and found out I was not using the standard double quotes "
in my script which I copied and pasted from the official Google Doc
In my particular case, I had this added in my manifest.json
:
"storage": {
"managed_schema": "storage.json"
}
But my storage.json
was empty. I had to edit my storage.json
file with this content:
{
"$schema": "http://json-schema.org/draft-03/schema#",
"type": "object",
"properties": {
"adminSettings": {
"title": "A valid JSON string compliant with backup format.",
"description": "All entries present will overwrite local settings.",
"type": "string"
}
}
}
But in general, here's my advice when you get this Line 1 Col 1 Unexpected Token misleading error that basically translates to: Something is wrong in one or more sections of your JSON and may or may not have anything to do with syntax in this file.
manifest.json
file such as manifest_version
, name
, description
, etc. manifest.json
. This is how I found out that my storage
block was the problem. I looked at another Chrome Extension to see how they did things and realized my error.