ASP.NET
--
Questions
--
Followers
Top Experts
JSON.parse Invalid character error
I am trying to retrieve a json string and parsing it.
I've tried both:
var obj = $.parseJSON(data);
and
var t = JSON.parse(data);
They return "Invalid character error."
My data being returned is:
And when I view it in the debugger, it looks like this:

It is erroring in the jquery-1.11.2.min.js file with the catch here:

And the actual error looks like above when I step through it.
I looked at all the examples and they were using single quotes, so I found and used a manual serializer and sent this instead, with single quotes instead of the double quotes, so there would be no escaped characters.
But still the same error. Do you see any reason I should be getting the invalid character error?
thanks!
I've tried both:
var obj = $.parseJSON(data);
and
var t = JSON.parse(data);
They return "Invalid character error."
My data being returned is:
{"AttemptId":"5180301"}
And when I view it in the debugger, it looks like this:
It is erroring in the jquery-1.11.2.min.js file with the catch here:
And the actual error looks like above when I step through it.
I looked at all the examples and they were using single quotes, so I found and used a manual serializer and sent this instead, with single quotes instead of the double quotes, so there would be no escaped characters.
{'AttemptId':'123456'}
But still the same error. Do you see any reason I should be getting the invalid character error?
thanks!
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
ASKER CERTIFIED SOLUTION
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
that was it! thanks!
You're welcome!
Glad that helped.
Thanx 4 axxepting.
Glad that helped.
Thanx 4 axxepting.
I just posted a new one. Maybe you can help there too.
https://www.experts-exchange.com/questions/28742065/JSON-parse-dataStr-returns-undefined-how-to-get-just-the-string.html
https://www.experts-exchange.com/questions/28742065/JSON-parse-dataStr-returns-undefined-how-to-get-just-the-string.html






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
ASP.NET
--
Questions
--
Followers
Top Experts
The successor to Active Server Pages, ASP.NET websites utilize the .NET framework to produce dynamic, data and content-driven web applications and services. ASP.NET code can be written using any .NET supported language. As of 2009, ASP.NET can also apply the Model-View-Controller (MVC) pattern to web applications