3

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!

2
  • 1
    try use this to validate your json link. Your json return error Commented Apr 18, 2018 at 10:59
  • remove the last comma Commented Apr 18, 2018 at 12:23

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

Comments

0

Remove comma after close brace after last object

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.