Modify ↓
Ticket #7572 (closed bug: invalid)
parseJSON throws invalid JSON exception on valid JSON
| Reported by: | birk.brauer@… | Owned by: | |
|---|---|---|---|
| Priority: | undecided | Milestone: | 1.5 |
| Component: | unfiled | Version: | 1.4.4 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
here is the original JSON:
{ 'content' : [
{'id':1,'name':'Personal Information','len':3},
{'id':2,'name':'Income','len':2},
{'id':3,'name':'Family','len':2},
{'id':4,'name':'Child I','len':3}
]}
here the original error:
Error: uncaught exception: Invalid JSON: {'content' : [{'id':1,'name':'Personal Information','len':3},{'id':2,'name':'Income','len':2},{'id':3,'name':'Family','len':2},{'id':4,'name':'Child I','len':3}]}
I got the same error on FF3.6, Chrome7 and IE7.
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

Thanks for taking the time to contribute to the jQuery project by writing a bug ticket and providing a testcase but this isn't valid JSON. JSON requires you to use double quotes for strings. The use of single quotes isn't a valid option
Please check http://www.json.org/.
I assume this happened because you are hand-crafting your JSON strings. Don't do that. Code for generating JSON data is available for a large variety of programming languages. http://www.json.org/ also provides a comprehensive listing of existing JSON libraries, organized by language.