简体   繁体   中英

'$' symbol in json - how to parse in javascript

My JSON looks like

var f =  { feed:                                                                                                                                                                                                             
{ '$':                                                                                                                                                                                                           
  { xmlns: 'http://www.w3.org/2005/Atom',                                                                                                                                                                       
    'xmlns:media': 'http://search.yahoo.com/mrss/',                                                                                                                                                             
   'xml:lang': 'en-US' },                                                                                                                                                                                      
 id: [ 'tag:github.com,2008:/bevry/feedr/commits/master' ],                                                                                                                                                     
link: [ [Object], [Object] ],                                                                                                                                                                                  
title: [ 'Recent Commits to feedr:master' ],                                                                                                                                                                   
updated: [ '2013-06-28T15:29:11-07:00' ],                                                                                                                                                                      
entry:                                                                                                                                                                                                         
  [ [Object]]
   }
 }
}

I am trying to parse it in javascript,

but if I do console.log(f.feed.$) it returns undefined.

Same with f.feed.$.title, f.feed['$'].title

JSON对象的末尾有一个额外的}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM