SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Dec 2007
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    JSON in javascript

    i have json element(in the obj) like this

    "media:thumbnail":
    {
    "width":"120",
    "url":"http:\/\/img.youtube.com\/vi\/3G_JTMuHOQk\/default.jpg",
    "height":"90"
    },

    i am trying to access the "url" part in that element, is this this the rightway

    "data_obj.value.media:thumbnail.url"

    but i am getting the error because it has colon) operator in it.

    then how to access the url part? and the url part contains many '\'.(i want this to be look like as this when i use that image http://img.youtube.com/vi/3G_JTMuHOQk/default.jpg ).

    how could i do that? can any one help me with this?

    thanks

  2. #2
    SitePoint Enthusiast
    Join Date
    Dec 2007
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    can you post the original JSON
    Mashups, DOM Scripting and all the things we call Web2.0 blogger
    http://www.heavyweightgeek.org/
    http://twitter.com/heavyweightgeek

  3. #3
    SitePoint Enthusiast
    Join Date
    Dec 2007
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    here is the link for that:

    http://pipes.yahoo.com/pipes/pipe.ru...YouTubeResults

    just click on it'll open up.

    i am doing like this.i think this is wrong

    thumbimg.setAttribute('src',data_obj.value.items[i].media:thumbnail.url);

    thanks

  4. #4
    SitePoint Enthusiast
    Join Date
    Dec 2007
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok here goes
    Code:
    data_obj.value.items[0]['media:thumbnail'].url
    me 1, crap JSON 0
    Mashups, DOM Scripting and all the things we call Web2.0 blogger
    http://www.heavyweightgeek.org/
    http://twitter.com/heavyweightgeek


Bookmarks

Posting Permissions

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