JSON exception: org.json.JSONException: Unterminated array

I am working on an Android application that requests some data from the server, and the server returns the data in JSON format. Everything works fine except for the API. After debugging, I found this exception:

org.json.JSONException: Unterminated array at character 152 of

{
    "total": "2",
    "result": [
        {
            "id": "15",
            "ename": "Horror movies based on true stories",
            "vname": "Những phim kinh dị dựa trên chuyện có thật",
            "movies": "16"
        }{
            "id": "14",
            "ename": "IMDB Top 250",
            "vname": "250 bộ phim hay nhất mọi thời đại",
            "movies": "127"
        }{
            "id": "13",
            "ename": "10 good movies for women",
            "vname": "10 bộ phim hay dành cho phái đẹp",
            "movies": "10"
        }{
            "id": "12",
            "ename": "The 84th Annual Academy Awards",
            "vname": "Giải Oscars lần thứ 84 (2012)",
            "movies": "37"
        }{
            "id": "11",
            "ename": "Charlie Chaplin collection",
            "vname": "Tuyển tập hề Sác lô",
            "movies": "7"
        }{
            "id": "10",
            "ename": "Tuyển tập điệp viên 007",
            "vname": "007 collection",
            "movies": "23"
        }{
            "id": "9",
            "ename": "Donnie Yen movies collection",
            "vname": "Tuyển tập phim Chung Tử Đơn",
            "movies": "24"
        }{
            "id": "8",
            "ename": "Back to the Future trilogy",
            "vname": "Tuyển tập "Trởlạitươnglai"",
            "movies": "3"
        }{
            "id": "7",
            "ename": "Stieg Larssons Millennium trilogy",
            "vname": "Bộ tiểu thuyết Millenium của nhà văn Stieg Larsson",
            "movies": "3"
        }{
            "id": "6",
            "ename": "Chan Wook Parks vengeance trilogy",
            "vname": "Bộ ba phim Báo thù của đạo diễn Park Chan Wook",
            "movies": "3"
        }
    ]
}

I searched on the internet but no luck. And I also consider the character of the 152nd, but nothing bad! Please help me!

+3
source share
5 answers

I see something wrong:

Array elements must be separated by commas:

{
    "total":"2",
    "result":  [
        {
            "id":"15",
            "ename":"Horror movies based on true stories",
            "vname":"Nh?ng phim kinh d? du?a tren chuye?n co? tha?t",
            "movies":"16"
        }**,COMMA**
        {
            "id":"14",
            "ename":"IMDB Top 250","vname":"250 b? phim hay nh?t m?i th?i d?i",
            "movies":"127"
        }
    ]
}

Notice that I placed the line COMMAto emphasize the place. You need to add only ,without COMMA.

+6
source

json, . :

[{"vname": "Tuyển tập \"Trởlạitươnglai\""}]
+6

{
    "total": "2",
    "result": [
        {
            "id": "15",
            "ename": "Horror movies based on true stories",
            "vname": "Những phim kinh dị dựa trên chuyện có thật",
            "movies": "16"
        },
        {
            "id": "14",
            "ename": "IMDB Top 250",
            "vname": "250 bộ phim hay nhất mọi thời đại",
            "movies": "127"
        },
        {
            "id": "13",
            "ename": "10 good movies for women",
            "vname": "10 bộ phim hay dành cho phái đẹp",
            "movies": "10"
        },
        {
            "id": "12",
            "ename": "The 84th Annual Academy Awards",
            "vname": "Giải Oscars lần thứ 84 (2012)",
            "movies": "37"
        },
        {
            "id": "11",
            "ename": "Charlie Chaplin collection",
            "vname": "Tuyển tập hề Sác lô",
            "movies": "7"
        },
        {
            "id": "10",
            "ename": "Tuyển tập điệp viên 007",
            "vname": "007 collection",
            "movies": "23"
        },
        {
            "id": "9",
            "ename": "Donnie Yen movies collection",
            "vname": "Tuyển tập phim Chung Tử Đơn",
            "movies": "24"
        },
        {
            "id": "8",
            "ename": "Back to the Future trilogy",
            "vname": "Tuyển tập Trởlạitươnglai",
            "movies": "3"
        },
        {
            "id": "7",
            "ename": "StiegLarssonsMillenniumtrilogy",
            "vname": "BộtiểuthuyếtMilleniumcủanhàvănStiegLarsson",
            "movies": "3"
        },
        {
            "id": "6",
            "ename": "ChanWookParksvengeancetrilogy",
            "vname": "BộbaphimBáothùcủađạodiễnParkChanWook",
            "movies": "3"
        }
    ]
}

, , " extra Trở lại tương lai, .

+3

json-, Jsonarray result

JSON,

{
  "total": "2",
  "result": [
    {
      "id": "15",
      "ename": "Horror movies based on true stories",
      "vname": "Những phim kinh dị dựa trên chuyện có thật",
      "movies": "16"
    }{
      "id": "14",
      "ename": "IMDB Top 250",
      "vname": "250 bộ phim hay nhất mọi thời đại",
      "movies": "127"
    }{
      "id": "13",
      "ename": "10 good movies for women",
      "vname": "10 bộ phim hay dành cho phái đẹp",
      "movies": "10"
    }{
      "id": "12",
      "ename": "The 84th Annual Academy Awards",
      "vname": "Giải Oscars lần thứ 84 (2012)",
      "movies": "37"
    }{
      "id": "11",
      "ename": "Charlie Chaplin collection",
      "vname": "Tuyển tập hề Sác lô",
      "movies": "7"
    }{
      "id": "10",
      "ename": "Tuyển tập điệp viên 007",
      "vname": "007 collection",
      "movies": "23"
    }{
      "id": "9",
      "ename": "Donnie Yen movies collection",
      "vname": "Tuyển tập phim Chung Tử Đơn",
      "movies": "24"
    }{
      "id": "8",
      "ename": "Back to the Future trilogy",
      "vname": "Tuyển tập "Trởlạitươnglai"",
      "movies": "3"
    }{
      "id": "7",
      "ename": "Stieg Larssons Millennium trilogy",
      "vname": "Bộ tiểu thuyết Millenium của nhà văn Stieg Larsson",
      "movies": "3"
    }{
      "id": "6",
      "ename": "Chan Wook Parks vengeance trilogy",
      "vname": "Bộ ba phim Báo thù của đạo diễn Park Chan Wook",
      "movies": "3"
    }
  ]
}
+2

All Articles