1

I am getting the following string when I try to JSON.parse the string, I get the following error

undefined:1
{"device":"FaclonTest","data":[{"tag":"LATITUDE","value":1903.5091},{"tag":"LONGITUDE","value":07251.0348}]}

Where am I going wrong, can someone help?

3
  • 1
    Can you show some code? Commented Feb 1, 2017 at 8:56
  • 2
    Good Lord, please allow Dark Lord to use debugger and online json parse tools Commented Feb 1, 2017 at 8:58
  • var news2 = news.replace(" ","").replace("\n",""); console.log(news2); var jso= JSON.parse(news2); When parsing I get the error Commented Feb 1, 2017 at 8:58

1 Answer 1

3

You have a problem with "value":07251.0348. Number should not begin with 0. If you remove that leading zero, everything should start working. So try to change "value":07251.0348 to "value":7251.0348

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.