JSON issues in playn with HTML5

289 Views Asked by At

I have problems with JSON in playN 1.0.3 on HTML5. When I call JSON.parse(mystring) and try to decode the json document below I get this error:

com.google.gwt.core.client.JavaScriptException: (SyntaxError): JSON.parse: unexpected end of data

Note: JSON.parse() works in Java-Mode with this string perfectly. Moreover I validated the JSON-document using a JSON document validator (JSONLint).

Does anybody see the problem? Maybe the array or the objects in the array are the problem, right? Maybe it's too long? In reality, my array has 15 objects, which look similar to these three objects in the array below.

{
    "Array": [
        {
            "CorrectAnswer": "A",
            "AnswerA": "A",
            "AnswerD": "D",
            "Artist": "Artist",
            "AnswerB": "B",
            "Title": "Title",
            "AnswerC": "C"
        },
        {
            "CorrectAnswer": "A",
            "AnswerA": "A",
            "AnswerD": "D",
            "Artist": "Artist",
            "AnswerB": "B",
            "Title": "Title",
            "AnswerC": "C"
        },
        {
            "CorrectAnswer": "A",
            "AnswerA": "A",
            "AnswerD": "D",
            "Artist": "Artist",
            "AnswerB": "B",
            "Title": "Title",
            "AnswerC": "C"
        }
    ]
}
1

There are 1 best solutions below

0
On BEST ANSWER

The problem is the same-orign-policy. Thanks to Quan. The solution is to deploy the war of the PlayN-html to the server (see Collaboration from PlayN client with server)