Claudia McCormack
Claudia McCormack

Reputation: 11

JSON file shows parse error, but everything looks fine (JSON, AngularJS)

I'm working with a JSON file that was sent to me. I keep getting a parse error on line 7 (begins with "overview) of this JSON file. The error reads: Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '['

I ran the JSON through JSONLint and got the same message. What's going on here? You can see the file below (I've only included the beginning here, since it's long. I tried removing the entry that causes the error to see if it was a random thing, but the "overview" name causes the same error on the next entry as well). Any thoughts would be very helpful!

{
    "page": 1,
    "results": [{
        "poster_path": "\/il9XWx5CbNd2KdDUwrcClEZiLkv.jpg",
        "adult": false,
        "overview": "Last months of World War II in April 1945. As the Allies make their final push in the European Theater,
        a battle - hardened U.S.Army sergeant in the 2 nd Armored Division named Wardaddy commands a Sherman tank called Fury and its five - man crew on a deadly mission behind enemy lines.Outnumbered and outgunned,
        Wardaddy and his men face overwhelming odds in their heroic attempts to strike at the heart of Nazi Germany.
        ",
        "release_date": "2014-10-15",
        "genre_ids": [10752,
            18,
            28
        ],
        "id": 228150,
        "original_title": "Fury",
        "original_language": "en",
        "title": "Fury",
        "backdrop_path": "\/pKawqrtCBMmxarft7o1LbEynys7.jpg",
        "popularity": 11.717304,
        "vote_count": 2435,
        "video": false,
        "vote_average": 7.43

// more entries with the same name/value pairs... same error for next entry
// when I get to the "overview" name.

    }],
    "total_results": 70,
    "total_pages": 4
}

Upvotes: 0

Views: 84

Answers (1)

Paweł
Paweł

Reputation: 4516

  1. don't use comments
  2. don't break the lines (String Values) - "overview" property;

{
    "page": 1,
    "results": [{
        "poster_path": "\/il9XWx5CbNd2KdDUwrcClEZiLkv.jpg",
        "adult": false,
        "overview": "Last months of World War II in April 1945. As the Allies make their final push in the European Theater, a battle - hardened U.S.Army sergeant in the 2 nd Armored Division named Wardaddy commands a Sherman tank called Fury and its five - man crew on a deadly mission behind enemy lines.Outnumbered and outgunned, Wardaddy and his men face overwhelming odds in their heroic attempts to strike at the heart of Nazi Germany.",
        "release_date": "2014-10-15",
        "genre_ids": [10752,
            18,
            28
        ],
        "id": 228150,
        "original_title": "Fury",
        "original_language": "en",
        "title": "Fury",
        "backdrop_path": "\/pKawqrtCBMmxarft7o1LbEynys7.jpg",
        "popularity": 11.717304,
        "vote_count": 2435,
        "video": false,
        "vote_average": 7.43
    }],
    "total_results": 70,
    "total_pages": 4
}

Upvotes: 1

Related Questions