Skip to content
Discussion options

You must be logged in to vote

Hello @telumletiferum ,

Hi! 👋 The error you're seeing:

Uncaught SyntaxError: JSON.parse: expected ',' or '}'

…usually means there's an issue with how the JSON is written in your data-file-upload attribute.

In Astro, when passing JSON with double quotes (like inside an SVG string), you must escape those quotes using \\" and wrap with data-file-upload={` .... `} — because the string is being interpreted as JavaScript inside a JSX-like expression. If you don't escape them, the browser can't parse it correctly.

✅ Here's how to fix it:

  <div
      data-file-upload={`{
        "url": "/upload",
        "extensions": {
          "csv": {
            "icon": "<svg xmlns=\\"http://www.w3.org/2000…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@telumletiferum
Comment options

Answer selected by telumletiferum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants