Error message when parsing obj = JSON.parse(json)

  • dannybuzzby365
  • Newbie
  • Newbie
  • dannybuzzby365
  • Posts: 6

Post 3+ Months Ago

I have a site that is up and running here
[url]http: // gfrn. co. uk[/url]
if you scroll down you will see that there is an error. NO TRACK FOUND. the listeners are numbered but no track comes through.

if you click on any other radio station the track is loaded and the radio plays.

I have been told that there is something wrong with the json script

how do i validate this
Code: [ Select ]
obj = JSON.parse(json)

to make sure that what i want to hapen actually does happen. its supposed to be parsing a string but nothing is happening

any more information you need please ask

the full code section is here

Code: [ Select ]
      jLogger("The Json getting returned is: "+json, "INFO"); 
            obj = JSON.parse(json);   
            trackname = obj.trackname;  
            curListeners = obj.currentListeners;
            currentDateTime = obj.datetimeStamp;
  1.       jLogger("The Json getting returned is: "+json, "INFO"); 
  2.             obj = JSON.parse(json);   
  3.             trackname = obj.trackname;  
  4.             curListeners = obj.currentListeners;
  5.             currentDateTime = obj.datetimeStamp;
  • dannybuzzby365
  • Newbie
  • Newbie
  • dannybuzzby365
  • Posts: 6

Post 3+ Months Ago

how do i add some debug / validation / sanitation code to prevent the error
  • spork
  • Brewmaster
  • Silver Member
  • spork
  • Posts: 6302
  • Loc: Seattle, WA

Post 3+ Months Ago

What does your JSON data look like? What error does JSON.Parse() throw?
  • dannybuzzby365
  • Newbie
  • Newbie
  • dannybuzzby365
  • Posts: 6

Post 3+ Months Ago

The attached image shows what the error is being thrown back
Attachments:
ErrorCapture1.jpg

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 25 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2017. Ozzu® is a registered trademark of Unmelted, LLC.