1

I am getting following json string as JSON response. I am using genson to generate json string. At client side, am overriding parse method of backbone collection to convert json string to collection of objects. Am not sore what is wrong with following JSON response.

"[
    {
        \"dateTime\": \"Jul1,
        2014\",
        \"errorCode\": \"\",
        \"id\": 1,
        \"message\": \MasterArgs: \",
        \"methodName\": \"\"
    },
    {
        \"dateTime\": \"Jul1,
        2014\",
        \"errorCode\": \"\",
        \"id\": 2,
        \"message\": \MasterVMArgs: \",
        \"methodName\": \"\"
    },
    {
        \"dateTime\": \"Jul1,
        2014\",
        \"errorCode\": \"12003\",
        \"id\": 3,
        \"message\": \"versions.\",
        \"methodName\": \"\"
    },
    {
        \"dateTime\": \"Jul1,
        2014\",
        \"errorCode\": \"\",
        \"id\": 4,
        \"message\": \"javafiles\",
        \"methodName\": \"\"
    },
    {
        \"dateTime\": \"Jul1,
        2014\",
        \"errorCode\": \"1450\",
        \"id\": 5,
        \"message\": \"TProcessingC: /ProgramFiles\",
        \"methodName\": \"\"
    }
]" 
user3841837
  • 53
  • 1
  • 7
  • Dude, give us the actual JSON response, not the one from the code that generates it. The actual one will not have the back-slashes and it won't be surrounded by quotes. – Jonathan M Aug 12 '14 at 19:23
  • I am getting above as a response, when I parse it with Backbone's parse method. I am using Genson to generate it from ArrayList of Objects. – user3841837 Aug 12 '14 at 19:27
  • I am new to JSON. Can you please let me know what do you mean by actual json response. – user3841837 Aug 12 '14 at 19:28
  • Your JSON should be formatted according to the specification at json.org. Remove the opening and closing double-quotes, remove the back-slashes, and you might want to remove the new-line in the middle of quoted strings. – Jonathan M Aug 12 '14 at 19:38
  • @user3841837 can you please provide the java code that produces this JSON. – eugen Aug 13 '14 at 10:35
  • @user3841837 Have you solved your problem? – Salem Aug 27 '14 at 19:51

1 Answers1

1

Remove whatever is making dateTime strings be divided in two lines:

{
    "dateTime": "Jul1,          // <---- should be "Jul1, 2014"
    2014",                      // 
    "errorCode": "",
    "execID": 1,
    // (...)
}
Salem
  • 12,808
  • 4
  • 34
  • 54