I keep on getting a JSON parser error for the following data:
[{"data":"Aerospace and Defense"},{"data":"Agriculture"},{"data":"Business Services"},{"data":"Chemicals"},{"data":"Construction"},{"data":"Consumer Goods and Services"},{"data":"Education"},{"data":"Electronics"},{"data":"Energy and Utilities"},{"data":"Environmental Services and Equipment"},{"data":"Financial Services"},{"data":"Food and Beverage"},{"data":"Healthcare Goods and Services"},{"data":"Industrial Goods and Services"},{"data":"Information Technology"},{"data":"Metals and Mining"},{"data":"Security Products and Services"},{"data":"Software"},{"data":"Telecom"},{"data":"Tranportation and Storage"}]
Can anyone please identify what the error is? I was originally using “Aerospace & Defense” and thought that the special character might be the issue. But it doesn’t look like it.
I use the ASP.NET MVC JSONResult to pass this back to jQuery. FireFox and IE show the data being created correctly, but the jquery parser throws an error. I have heard that the parser has been modified significantly in the new jQuery.
Any help would be highly appreciated.
Thank You for your amazing responses. Here is what I found out after further research.
I am using jquery1.5 and turns out there was something very interesting going on. I had a separate post on jsTree because I originally thought it was JSTree that was giving me an error, but turns out this is definitely not jsTree but may be jQuery related.
Due to the nature of the deadline on this project, I haven’t been able to research the entire issue, but I have definitely found a workaround. Hope this helps:
jsTree JSON with MVC