Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fetching JSON data: Syntax error

I installed this Drag and Drop plugin and tried to fetch my data from a local JSON file, however, I endeavoured an error: "Module build failed: SyntaxError: Unexpected token ] in JSON!" The JSON code I am using is down below.

    {"games":[
    {
        "id":"1",
        "name":"F5",
        "link":"someLink",
        "price":"50$"
    },
    {
        "id":"2",
        "name":"BnS",
        "link":"someLink",
        "price":"35$"
    },
    {
        "id":"3",
        "name":"WoW",
        "link":"someLink",
        "price":"55$"
    },
]}

Where is the problem? Thanks in advance!

like image 556
Ivan Zavalinich Avatar asked Jun 13 '26 00:06

Ivan Zavalinich


1 Answers

Your JSON is invalid. You can try this one:

{
    "games": [{
            "id": "1",
            "name": "F5",
            "link": "someLink",
            "price": "50$"
        },
        {
            "id": "2",
            "name": "BnS",
            "link": "someLink",
            "price": "35$"
        },
        {
            "id": "3",
            "name": "WoW",
            "link": "someLink",
            "price": "55$"
        }
    ]
}

Here's a useful tool for validating JSON, which I just utilised to fix your code.

like image 68
undefined Avatar answered Jun 15 '26 12:06

undefined



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!