-1

anything wrong with below json? I really scratch my head for this, for me it's perfectly ok but didn't pass jslintor. https://i.stack.imgur.com/BR6Sw.png

[  
        {
        'uId':1,
        'tabId':1,
        'taskId':1,
         'name':'hang clothes', 
         'date':'24/3/2014',
         'time':'12 am',
         'done':false
         },
        {
        'uId':1,
        'tabId':2,
        'taskId':2,
         'name':'practice basketball',
         'date':'24/3/2014',
         'time':'12 am',
         'done':false
         },
         {
            'uId':1,
            'tabId': 3,
            'name':'nikon D5300',
            'date' : '14/4/2014',
            'done': false
         }
]

the lintor says this

Parse error on line 2:
[    {        'uId': 1,        't
--------------^
Expecting 'STRING', '}'
user3522457
  • 2,845
  • 6
  • 23
  • 24

3 Answers3

1

As per Json standard, double quote is the standard used not single quote. If you replace all your double quotes with single quotes, it should be fine. For more details refer to: http://www.json.org/

Ankit Bansal
  • 4,962
  • 1
  • 23
  • 40
1

"A name/value pair consists of a field name (in double quotes), followed by a colon, followed by a value"

In your JSON, you have single quotes. Replace all '(quotes) with "(double quotes) and it is a valid JSON. Tested and confirmed before posting as well

canova
  • 3,965
  • 2
  • 22
  • 39
0

Refer to this jQuery.parseJSON single quote vs double quote

Single quote is not considered standard.

You can easily debug your json using tool such as this:

http://jsoneditoronline.org/index.html

Community
  • 1
  • 1
maethorr
  • 594
  • 4
  • 7