我需要提取以下JSON @name
"@name": "Reuters TV iOS",
"license": [{
"@name": "Apache License 2.0",
"component": [{
"name": "RMStore",
"url": "http://github.com/robotmedia/RMStore/"
}, {
"name": "mixpanel-iphone",
"url": "http://github.com/mixpanel/mixpanel-iphone/"
}, {
"name": "facebook-ios-sdk",
"url": "http://github.com/facebook/facebook-ios-sdk/"
}],
"licensetext": "text "
}, {
"@name": "Apple MIT License",
"component": {
"name": "Apple iOS Developer Library",
"url": ""
},
"licensetext": " text"
}, {
"@name": "BSD 3-clause \"New\" or \"Revised\" License",
"component": [{
"name": "Reachability-DDG",
"url": ""
}, {
"name": "Tweaks",
"url": "http://github.com/facebook/Tweaks/"
}, {
"name": "NYXImagesKit",
"url": "http://github.com/Nyx0uf/NYXImagesKit/"
}, {
"name": "pop",
"url": "http://github.com/facebook/pop/"
}, {
"name": "JLRoutes",
"url": "http://github.com/joeldev/JLRoutes/"
}],
"licensetext": "text "
}, {
"@name": "Deusty BSD- License",
"component": {
"name": "CocoaLumberjack",
"url": "http://github.com/CocoaLumberjack/CocoaLumberjack/"
},
"licensetext": " text"
}, {
"@name": "MIT License",
"component": [{
"name": "SDWebImage",
"url": "http://github.com/rs/SDWebImage/"
}, {
"name": "SVProgressHUD",
"url": "http://github.com/TransitApp/SVProgressHUD/"
}, {
"name": "TableViewCellWithAutoLayout",
"url": ""
}, {
"name": "OHHTTPStubs",
"url": "http://github.com/AliSoftware/OHHTTPStubs/"
}, {
"name": "XCTestAsync",
"url": "http://github.com/touchableideas/XCTestAsync/"
}, {
"name": "objection",
"url": "http://github.com/atomicobject/objection/"
}, {
"name": "houston",
"url": "http://github.com/nomad/houston/"
}, {
"name": "YLMoment",
"url": "http://github.com/YannickL/YLMoment/"
}, {
"name": "ReactiveCocoa",
"url": "http://github.com/ReactiveCocoa/ReactiveCocoa/"
}, {
"name": "cocos2d-iphone",
"url": "http://github.com/cocos2d/cocos2d-iphone/"
}, {
"name": "Aspects",
"url": "http://github.com/steipete/Aspects/"
}, {
"name": "TTTAttributedLabel",
"url": "http://github.com/mattt/TTTAttributedLabel/"
}, {
"name": "Mantle",
"url": "http://github.com/Mantle/Mantle/"
}, {
"name": "Masonry",
"url": "http://github.com/Masonry/Masonry/"
}, {
"name": "apple_push_certs",
"url": "http://rubygems.org/gems/apple_push_certs"
}, {
"name": "HockeySDK-iOS",
"url": "http://github.com/bitstadium/HockeySDK-iOS/"
}],
"licensetext": " text "
}, {
"@name": "OpenSSL Combined License",
"component": {
"name": "OpenSSL",
"url": "http://www.openssl.org/"
},
"licensetext": "text"
}, {
"@name": "SIL Open Font License 1.1",
"component": {
"name": "Font-Awesome",
"url": "http://github.com/FortAwesome/Font-Awesome/"
},
"licensetext": "text"
}, {
"@name": "zlib License",
"component": [{
"name": "iCarousel",
"url": "http://github.com/nicklockwood/iCarousel/"
}, {
"name": "FXKeychain",
"url": "http://github.com/nicklockwood/FXKeychain/"
}, {
"name": "FXForms",
"url": "http://github.com/nicklockwood/FXForms/"
}],
"licensetext": "text"
}],
"isProjectComplete": "true"
};
我可以获得name
,URL
和license
,但不知道如何让@name
显示在顶部,例如" Apache许可证2.0"。
这是当前状态:jsfiddle
答案 0 :(得分:0)
答案 1 :(得分:0)
如果我理解正确,你的问题是你不能在JS属性名中使用像@这样的特殊字符。
只需使用括号:json['@name']