www.webdeveloper.com
Results 1 to 2 of 2

Thread: Comparing JSON data

  1. #1
    Join Date
    Apr 2010
    Location
    Brooklyn NY
    Posts
    104

    Comparing JSON data

    I'm trying to compare incoming JSON data to the existing data to see if there are any changes, but for giant objects like:

    Code:
    [{"date":"2011-09-03 23:06:03","notifier_id":"1","type":"1","unread":"0"},{"date":"2011-09-05 00:37:46"}]
    
    if (JSON.stringify(oldData) == JSON.stringify(newData))
    This doesn't seem to work. I've tried using:

    Code:
    escape("'" + JSON.stringify(W.notification.list + "'"))
    but that ignores the objects properties and returns something like 22%5Bobject%20Object%5D%2C%5Bobject

    I'm sure there's got to be an easier way, if anyone has any ideas, please shoot

  2. #2
    Join Date
    Apr 2010
    Location
    Brooklyn NY
    Posts
    104

    resolved

    I just noticed the comparison is correct. My old data was getting modified, so when the new data was coming in, it was getting compared to the modified data.

    I'm an idiot.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles