Raja Manickam
Raja Manickam

Reputation: 1903

JSON Error while encoding the data

The following encoded JSON which causes an error of

Parse error on line 9: ...0.0.1", "Admin (Blue) Change ----------------------^ Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '['

I'm new to the JSON so Can anyone help me to resolve this error

{
        "draw": 2,
        "recordsTotal": 1739,
        "recordsFiltered": 1739,
        "data": [
            [
                "22-Apr-15 03:37 pm",
                "Task",
                "127.0.0.1",
                "Admin (Blue) Changed Plan to Task On:<\/b> 22-04-2015 03:37:51 PM
    CURRENT-Task Title: admin to employeee NEW-Task Title: admin to employeeesdfsd, CURRENT-Description: admin to employeeeadmin to employeeeadmin to employeee, NEW-Description: admin to employeeeadmin to employeeeadfdmin to employeee, CURRENT-Priority: Medium, NEW-Task Priority: Low, CURRENT-Size: Small, NEW-Size: Big, CURRENT-Status: Last, NEW-Task Status: S, CURRENT-Background Color: Empty, NEW-Background Color: #b83939, CURRENT-Text Color: Empty, NEW-Text Color: #faf5f5, CURRENT-Assigned To: Raja(Admin), NEW-Assigned To: Raja(Admin), Vimala(Bharath), CURRENT-Completion Date: 16-04-2015, NEW-Completion Date: 18-04-2015"
            ],
            [
                "22-Apr-15 03:38 pm",
                "Task",
                "127.0.0.1",
                "Bharath (Task) Task Edited On:<\/b> 22-04-2015 03:38:41 PM
    OLD-Task Title:admin to employeee, NEW-Task Title:admin to employeeesdfsd, OLD-Description:admin to employeeeadmin to employeeeadmin to employeee NEW-Description:admin to employeeeadmin to employeeeadfdmin to employeee, OLD-Priority:Medium, NEW-:PriorityLow, OLD-Size:Small, NEW-Size:Big, OLD-Status:S, NEW-Status:S, OLD-Assigned To:Raja(Admin), NEW-Assigned To:Raja(Admin), Vimala(Bharath), OLD-Completion Date:16-Apr-2015, NEW-Completion Date:18-Apr-2015"
            ],
            [
                "22-Apr-15 03:41 pm",
                "Plan",
                "127.0.0.1",
                "Bharath (Task) Plan Assigned On:<\/b> 22-04-2015 03:41:25 PM
    Plan Title:sdfs, Assigned To: Manickam(Admin), Priority: Medium, Size: Small, Completion Date: 20-04-2015"
            ],
            [
                "22-Apr-15 03:41 pm",
                "Plan",
                "127.0.0.1",
                "Bharath (Task) Plan Assigned On:<\/b> 22-04-2015 03:41:57 PM
    Plan Title:erwe, Assigned To: Admin, Priority: High, Size: Medium, Completion Date: 24-04-2015"
            ],
            [
                "22-Apr-15 04:13 pm",
                "Plan",
                "127.0.0.1",
                "Admin (Blue) Plan Assigned On:<\/b> 22-04-2015 04:13:46 PM
    Plan Title:dfg, Assigned To: Admin, Priority: Medium, Size: Medium, Completion Date: 09-04-2015"
            ],
            [
                "22-Apr-15 04:22 pm",
                "Plan",
                "127.0.0.1",
                "Admin (Blue) Plan Completed On:<\/b> 22-04-2015 04:22:24 PM
    Plan Title:sdf"
            ],
            [
                "22-Apr-15 04:22 pm",
                "Plan",
                "127.0.0.1",
                "Admin (Blue) Plan Uncompleted On:<\/b> 22-04-2015 04:22:34 PM
    Plan Title:activity assigned"
            ],
            [
                "22-Apr-15 04:22 pm",
                "Plan",
                "127.0.0.1",
                "Admin (Blue) Plan Uncompleted On:<\/b> 22-04-2015 04:22:35 PM
    Plan Title:activity assigned"
            ],
            [
                "22-Apr-15 04:26 pm",
                "Task",
                "127.0.0.1",
                "Admin (Blue) Edition Awaiting Approval On:<\/b> 22-04-2015 04:26:36 PM
    Task Title: activity assigned, CURRENT-Description: sdfs, NEW-Description: sdfswerwe"
            ],
            [
                "22-Apr-15 04:26 pm",
                "Plan",
                "127.0.0.1",
                "Admin (Blue) Plan Edition Changes Undone On:<\/b> 22-04-2015 04:26:52 PM
    Plan Title:activity assigned, CURRENT-Description:sdfs NEW-Description:sdfswerwe"
            ]
        ]
    }

Upvotes: 0

Views: 31

Answers (1)

T.J. Crowder
T.J. Crowder

Reputation: 1074295

You have raw newlines in your strings. The first one is at the end of

"Admin (Blue) Changed Plan to Task On:<\/b> 22-04-2015 03:37:51 PM

You can't do that in JSON. If you want a newline in the string, use \n.


Side note: If you're new to JSON, http://jsonlint.com/ is your friend. The error you get in this case, though, isn't very informative.

Upvotes: 1

Related Questions