我有一个JSON字符串,如下所示
[{"partner-code":"AMEX",
"partner":"American Express",
"issuer":"American Express",
"summary":[],
"description":[],
"url":"http://www.qantas.com.au/fflyer/dyn/partners/card-american-express",
"email":[],
"phone-number":[],
"mediafile":[],
"bonus-offer-summary":"Earn up to 50,000 bonus Points with the Qantas American Express Ultimate Card. Up to 7,500 bonus Points also available on the Qantas American Express Premium and Discovery Cards. Conditions and spend criteria apply.",
"bonus-offer-description":"You could earn up to 50,000 bonus points with the Qantas American Express Ultimate Card when you apply by 31 December 2013, are approved and meet the eligible spend criterias<sup>***</sup>. Also, you could earn up to 30,000 bonus points with the Qantas American Express Premium Card<sup>^^</sup> or up to 7,500 bonus points with the Qantas American Express Discovery Card<sup>**</sup> when you apply, are approved by 31 December 2013 and meet the eligible spend criteria.",
"show-bonus-offer":"",
"card-offerings":[{"card-name":"Qantas American Express Discovery Card",
"earning-points":"This credit card automatically earns Qantas Frequent Flyer points",
"website":"http://www.americanexpress.com/au/content/frequent-flyer-cards/qantas-discovery-card/?filter=qanseries&bkgd=3&PID=35&BUID=CCG&AFFID=Qantas&CRTV=Earn&PSKU=AQDB&sourcecode=25A996J001&CPID=100036881",
"contact-phone-number":"1300 736 978",
"usage-type":"Personal",
"card-level":"Classic",
"card-type-01":"American Express",
"annual-fee":"0","opt-in-fee":"0",
"supplementary-card-fee":"0",
"supplementary-card-fee-descriptor":"annual Card fee per Supplementary Card<sup>~</sup>",
"interest-rate":"20.74",
"interest-free-period":"Up to 44 days interest free on purchases when the closing balance (including any balance transfer or promotional amount) is paid in full by the statement due date<sup>$</sup>",
"earned-area":"<ul>\r\n\t<li>1 point per $1 eligible spend<sup>*</sup></li>\r\n\t<li>1 extra point per $1 spent in Australia on selected Qantas products & services<sup>+</sup></li>\r\n\t<li>Uncapped points earning<sup>^</sup></li>\r\n\t<li>This introductory offer is available to new<sup>**</sup> American Express Cardmembers only.</li>\r\n</ul>\r\n",
"other-features":"<ul>\r\n\t<li>Interest rate of 20.74% p.a.<sup>#</sup></li>\r\n\t<li>Annual card fee of $0</li>\r\n\t<li>$0 annual Card fee per Supplementary Card<sup>~</sup></li>\r\n\t<li>Up to 44 days interest free on purchases when the closing balance (including any balance transfer or promotional amount) is paid in full by the statement due date<sup>$</sup></li>\r\n\t<li>5,000 points after $300 spend<sup>**</sup> on purchases in first 3 months of becoming a Cardmember</li>\r\n\t<li>2,500 points after first Card spend<sup>**</sup> in Australia on selected Qantas products & services in Australia<sup>+</sup></li>\r\n\t<li>Introductory offer available to new<sup>**</sup> American Express Cardmembers only</li>\r\n</ul>\r\n"},
{"card-name":"Qantas American Express Premium Card",
"earning-points":"This credit card automatically earns Qantas Frequent Flyer points",
"website":"http://www.americanexpress.com/au/content/frequent-flyer-cards/qantas-premium-card/?filter=qanseries&bkgd=3&PID=35&BUID=CCG&AFFID=Qantas&CRTV=Earn&PSKU=MB9&sourcecode=25A9974001&CPID=100036882",
"contact-phone-number":"1800 040 398",
"usage-type":"Personal",
"card-level":"Gold",
"card-type-01":"American Express",
"annual-fee":"249","opt-in-fee":"0",
"supplementary-card-fee":"0",
"interest-rate":"20.74",
"cash-advance-rate":"0",
"interest-free-period":"Up to 44 days interest free on purchases when the closing balance (including any balance transfer or promotional amount) is paid in full by the statement due date<sup>$</sup>","earned-area":"<ul class=\"noindent\">\r\n\t<li>You can earn 2 points per dollar spent<sup>*</sup>. Click 'View Website' above for further details.</li>\r\n\t<li>Uncapped points earning<sup>^</sup></li>\r\n</ul>\r\n","other-features":"<ul class=\"noindent\">\r\n\t<li>Interest rate of 20.74% p.a.<sup>#</sup></li>\r\n\t<li>Annual card fee of $249</li>\r\n\t<li>$0 annual Card fee per Supplementary Card<sup>~</sup></li>\r\n\t<li>Up to 44 days interest free on purchases when the closing balance (including any balance transfer or promotional amount) is paid in full by the statement due date<sup>$</sup></li>\r\n\t<li>5,000 points after first Card spend<sup>^^</sup> on eligible purchases</li>\r\n\t<li>2,500 points after first Card spend<sup>^^</sup> on selected Qantas products & services in Australia<sup>+</sup></li>\r\n\t<li>22,500 points after $500 spend within the first three months<sup>^^</sup></li>\r\n\t<li>This introductory offer available to new<sup>^^</sup> American Express Cardmembers only.</li>\r\n\t<li>Complimentary Domestic and Overseas Travel Insurance<sup>##</sup> when you pay for travel with your Card</li>\r\n\t<li>2 Qantas Club invitations per year<sup>~~</sup> after your first Card spend on selected Qantas products & services<sup>+</sup> in Australia</li>\r\n</ul>\r\n"},{"card-name":"Qantas American Express Ultimate Card","earning-points":"This credit card automatically earns Qantas Frequent Flyer points","website":"http://www.americanexpress.com/au/content/frequent-flyer-cards/qantas-ultimate/?filter=qanseries",
"contact-phone-number":"1300 736 978",
"usage-type":"Personal",
"card-level":"Platinum",
"card-type-01":"American Express",
"interest-free-period":"Up to 44 days interest free on purchases when the closing balance (including any balance transfer or promotional amount) is paid in full by the statement due date<sup>$</sup>",
"earned-area":"<ul class=\"noindent\">\r\n\t<li>You can earn:</li>\r\n\t<li>3 Qantas points<sup>*</sup> per dollar spent on eligible Card purchases at:\r\n\t<ul type=\"disc\">\r\n\t\t<li>Tens of thousands of restaurants in Australia<sup>$$</sup></li>\r\n\t\t<li>Selected Qantas products and services in Australia<sup>+</sup></li>\r\n\t</ul>\r\n\t</li>\r\n\t<li>2 points per dollar spent* on eligible Card purchases at:\r\n\t<ul type=\"disc\">\r\n\t\t<li>airlines, accommodation, major cruise and tour operators paid directly or through travel agencies<sup>$$</sup></li>\r\n\t\t<li>Spend in foreign currency when overseas and online<sup>$$</sup></li>\r\n\t</ul>\r\n\t</li>\r\n\t<li>1 point per dollar spent* on eligible Card purchases at:\r\n\t<ul type=\"disc\">\r\n\t\t<li>All other providers, excluding those below</li>\r\n\t\t<li>Insurances offered by American Express</li>\r\n\t</ul>\r\n\t</li>\r\n\t<li>0.5 point per dollar spent* on eligible Card purchases at:\r\n\t<ul type=\"disc\">\r\n\t\t<li>Utilities which are gas, water and electricity providers</li>\r\n\t\t<li>Insurance offered by companies other than American Express</li>\r\n\t\t<li>Telecommunication providers which includes goods and services purchased from phone, mobile and internet service providers</li>\r\n\t\t<li>Government bodies including the Australian Taxation Office, Australia Post, federal/state and local government bodies</li>\r\n\t</ul>\r\n\t</li>\r\n</ul>\r\n","other-features":"<ul class=\"noindent\">\r\n\t<li>Interest rate of 20.74% p.a.<sup>#</sup></li>\r\n\t<li>Annual card fee of $450</li>\r\n\t<li>$0 annual Card fee per Supplementary Card<sup>~</sup></li>\r\n\t<li>Up to 44 days interest free on purchases when the closing balance (including any balance transfer or promotional amount) is paid in full by the statement due date<sup>$</sup></li>\r\n\t<li>5,000 points after first Card spend<sup>***</sup> on eligible purchases</li>\r\n\t<li>2,500 points after first Card spend<sup>***</sup> on selected Qantas products & services in Australia<sup>+</sup></li>\r\n\t<li>42,500 points after $500 spend within the first three months<sup>***</sup></li>\r\n\t<li>Introductory offer available to new<sup>***</sup> American Express Cardmembers only</li>\r\n\t<li>1 Complimentary domestic return flight<sup>+++</sup> between selected Australian Capital cities after your first Card spend every year in Australia on selected Qantas products and services<sup>+</sup></li>\r\n\t<li>Complimentary Domestic and Overseas Travel Insurance<sup>##</sup> when you pay for travel with your Card</li>\r\n</ul>\r\n"},
{"card-name":"Test Offering - Sarah",
"annual-fee":"0",
"opt-in-fee":"0",
"supplementary-card-fee":"0",
"interest-rate":"0",
"cash-advance-rate":"0"}
]
}]
我想在jQuery的客户端处理这个字符串,因为我是新手,我不知道任何人请建议最好的想法去。这基本上是一张卡片信息,就像这个'N'卡信息将在服务器回复中获取我必须在页面中显示卡片列表如果我们点击一张特定卡片将显示卡片的所有细节并且必须拖动放下并比较卡片。
所以我被困在显示列表中。 任何人都可以尽快帮忙。
提前致谢。
答案 0 :(得分:2)
您可以使用jQuery的函数parseJSON将JSON字符串解析为JavaScript对象 函数文档和搜索示例可以指导您解决问题的方法。
答案 1 :(得分:1)
使用JSON.parse(yourString)
解析JSON字符串后,或者在jQuery $.parseJSON(yourString)
的情况下,可以将其用作对象。
例如,如果你这样做:
//yourString is the String provided in the question
var jsonObject = JSON.parse(yourString);
alert(jsonObject.partner);
会发出警告:
美国运通