javascript - How to read this JSON with jquery -


how read json jquery? lets want data "quote" object. many thanks!

cbfunc({     "query": {         "count": "4",         "created": "2010-12-01t15:21:42z",         "lang": "en-us",         "diagnostics": {             "publiclycallable": "true",             "url": [{                 "execution-time": "3",                 "proxy": "default",                 "content": "http://datatables.org/alltables.env"             },             {                 "execution-time": "1",                 "proxy": "default",                 "content": "http://www.datatables.org/yahoo/finance/yahoo.finance.quotes.xml"             },             {                 "execution-time": "12",                 "proxy": "default",                 "content": "http://download.finance.yahoo.com/d/quotes.csv?f=aa2bb2b3b4cc1c3c6c8dd1d2ee1e7e8e9ghjkg1g3g4g5g6ii5j1j3j4j5j6k1k2k4k5ll1l2l3mm2m3m4m5m6m7m8nn4opp1p2p5p6qrr1r2r5r6r7ss1s7t1t7t8vv1v7ww1w4xy&s=yhoo,aapl,goog,msft"             },             {                 "execution-time": "18",                 "content": "select * csv url=@url , columns='ask,averagedailyvolume,bid,askrealtime,bidrealtime,bookvalue,change&percentchange,change,commission,changerealtime,afterhourschangerealtime,dividendshare,lasttradedate,tradedate,earningsshare,errorindicationreturnedforsymbolchangedinvalid,epsestimatecurrentyear,epsestimatenextyear,epsestimatenextquarter,dayslow,dayshigh,yearlow,yearhigh,holdingsgainpercent,annualizedgain,holdingsgain,holdingsgainpercentrealtime,holdingsgainrealtime,moreinfo,orderbookrealtime,marketcapitalization,marketcaprealtime,ebitda,changefromyearlow,percentchangefromyearlow,lasttraderealtimewithtime,changepercentrealtime,changefromyearhigh,percebtchangefromyearhigh,lasttradewithtime,lasttradepriceonly,highlimit,lowlimit,daysrange,daysrangerealtime,fiftydaymovingaverage,twohundreddaymovingaverage,changefromtwohundreddaymovingaverage,percentchangefromtwohundreddaymovingaverage,changefromfiftydaymovingaverage,percentchangefromfiftydaymovingaverage,name,notes,open,previousclose,pricepaid,changeinpercent,pricesales,pricebook,exdividenddate,peratio,dividendpaydate,peratiorealtime,pegratio,priceepsestimatecurrentyear,priceepsestimatenextyear,symbol,sharesowned,shortratio,lasttradetime,tickertrend,oneyrtargetprice,volume,holdingsvalue,holdingsvaluerealtime,yearrange,daysvaluechange,daysvaluechangerealtime,stockexchange,dividendyield'"             }],             "javascript": {                 "execution-time": "71",                 "instructions-used": "278867",                 "table-name": "yahoo.finance.quotes"             },             "user-time": "92",             "service-time": "16",             "build-version": "9962"         },         "results": {             "quote": [{                 "symbol": "yhoo",                 "ask": "16.21",                 "averagedailyvolume": "24744700",                 "bid": "16.20",                 "askrealtime": "16.21",                 "bidrealtime": "16.20",                 "bookvalue": "9.277",                 "change_percentchange": "+0.393 - +2.48%",                 "change": "+0.393",                 "commission": null,                 "changerealtime": "+0.393",                 "afterhourschangerealtime": "n/a - n/a",                 "dividendshare": "0.00",                 "lasttradedate": "12/1/2010",                 "tradedate": null,                 "earningsshare": "0.77",                 "errorindicationreturnedforsymbolchangedinvalid": "n/a",                 "epsestimatecurrentyear": "0.86",                 "epsestimatenextyear": "0.79",                 "epsestimatenextquarter": "0.19",                 "dayslow": null,                 "dayshigh": "16.23",                 "yearlow": "12.94",                 "yearhigh": "19.12",                 "holdingsgainpercent": "- - -",                 "annualizedgain": "-",                 "holdingsgain": null,                 "holdingsgainpercentrealtime": "n/a - n/a",                 "holdingsgainrealtime": null,                 "moreinfo": "cnsprmiied",                 "orderbookrealtime": "n/a",                 "marketcapitalization": "21.127b",                 "marketcaprealtime": null,                 "ebitda": "1.399b",                 "changefromyearlow": "+3.268",                 "percentchangefromyearlow": "+25.26%",                 "lasttraderealtimewithtime": "n/a - <b>16.208</b>",                 "changepercentrealtime": "n/a - +2.48%",                 "changefromyearhigh": "-2.912",                 "percebtchangefromyearhigh": "-15.23%",                 "lasttradewithtime": "10:05am - <b>16.208</b>",                 "lasttradepriceonly": "16.208",                 "highlimit": null,                 "lowlimit": null,                 "daysrange": "n/a - 16.23",                 "daysrangerealtime": "n/a - n/a",                 "fiftydaymovingaverage": "16.1875",                 "twohundreddaymovingaverage": "14.9097",                 "changefromtwohundreddaymovingaverage": "+1.2983",                 "percentchangefromtwohundreddaymovingaverage": "+8.71%",                 "changefromfiftydaymovingaverage": "+0.0205",                 "percentchangefromfiftydaymovingaverage": "+0.13%",                 "name": "yahoo! inc.",                 "notes": "-",                 "open": "16.04",                 "previousclose": "15.815",                 "pricepaid": null,                 "changeinpercent": "+2.48%",                 "pricesales": "3.16",                 "pricebook": "1.70",                 "exdividenddate": "12-may-04",                 "peratio": "20.54",                 "dividendpaydate": "n/a",                 "peratiorealtime": null,                 "pegratio": "1.40",                 "priceepsestimatecurrentyear": "18.39",                 "priceepsestimatenextyear": "20.02",                 "symbol": "yhoo",                 "sharesowned": null,                 "shortratio": "2.40",                 "lasttradetime": "10:05am",                 "tickertrend": " ++--++ ",                 "oneyrtargetprice": "18.07",                 "volume": "2751507",                 "holdingsvalue": null,                 "holdingsvaluerealtime": null,                 "yearrange": "12.94 - 19.12",                 "daysvaluechange": "- - +2.48%",                 "daysvaluechangerealtime": "n/a - n/a",                 "stockexchange": "nasdaqnm",                 "dividendyield": null,                 "percentchange": "+2.48%"             },             {                 "symbol": "aapl",                 "ask": "316.04",                 "averagedailyvolume": "18898400",                 "bid": "316.00",                 "askrealtime": "316.04",                 "bidrealtime": "316.00",                 "bookvalue": "52.175",                 "change_percentchange": "+4.87 - +1.57%",                 "change": "+4.87",                 "commission": null,                 "changerealtime": "+4.87",                 "afterhourschangerealtime": "n/a - n/a",                 "dividendshare": "0.00",                 "lasttradedate": "12/1/2010",                 "tradedate": null,                 "earningsshare": "15.154",                 "errorindicationreturnedforsymbolchangedinvalid": "n/a",                 "epsestimatecurrentyear": "18.97",                 "epsestimatenextyear": "22.06",                 "epsestimatenextquarter": "4.22",                 "dayslow": "315.00",                 "dayshigh": "316.50",                 "yearlow": "188.68",                 "yearhigh": "321.30",                 "holdingsgainpercent": "- - -",                 "annualizedgain": "-",                 "holdingsgain": null,                 "holdingsgainpercentrealtime": "n/a - n/a",                 "holdingsgainrealtime": null,                 "moreinfo": "cnsprmiied",                 "orderbookrealtime": "n/a",                 "marketcapitalization": "289.9b",                 "marketcaprealtime": null,                 "ebitda": "19.364b",                 "changefromyearlow": "+127.34",                 "percentchangefromyearlow": "+67.49%",                 "lasttraderealtimewithtime": "n/a - <b>316.02</b>",                 "changepercentrealtime": "n/a - +1.57%",                 "changefromyearhigh": "-5.28",                 "percebtchangefromyearhigh": "-1.64%",                 "lasttradewithtime": "10:05am - <b>316.02</b>",                 "lasttradepriceonly": "316.02",                 "highlimit": null,                 "lowlimit": null,                 "daysrange": "315.00 - 316.50",                 "daysrangerealtime": "n/a - n/a",                 "fiftydaymovingaverage": "309.455",                 "twohundreddaymovingaverage": "273.218",                 "changefromtwohundreddaymovingaverage": "+42.802",                 "percentchangefromtwohundreddaymovingaverage": "+15.67%",                 "changefromfiftydaymovingaverage": "+6.565",                 "percentchangefromfiftydaymovingaverage": "+2.12%",                 "name": "apple inc.",                 "notes": "-",                 "open": "315.665",                 "previousclose": "311.15",                 "pricepaid": null,                 "changeinpercent": "+1.57%",                 "pricesales": "4.38",                 "pricebook": "5.96",                 "exdividenddate": "21-nov-95",                 "peratio": "20.53",                 "dividendpaydate": "n/a",                 "peratiorealtime": null,                 "pegratio": "0.83",                 "priceepsestimatecurrentyear": "16.40",                 "priceepsestimatenextyear": "14.10",                 "symbol": "aapl",                 "sharesowned": null,                 "shortratio": "0.50",                 "lasttradetime": "10:05am",                 "tickertrend": " -=+-+- ",                 "oneyrtargetprice": "365.38",                 "volume": "3679572",                 "holdingsvalue": null,                 "holdingsvaluerealtime": null,                 "yearrange": "188.68 - 321.30",                 "daysvaluechange": "- - +1.57%",                 "daysvaluechangerealtime": "n/a - n/a",                 "stockexchange": "nasdaqnm",                 "dividendyield": null,                 "percentchange": "+1.57%"             },             {                 "symbol": "goog",                 "ask": "568.94",                 "averagedailyvolume": "3086980",                 "bid": "568.55",                 "askrealtime": "568.94",                 "bidrealtime": "568.55",                 "bookvalue": "135.606",                 "change_percentchange": "+13.208 - +2.38%",                 "change": "+13.208",                 "commission": null,                 "changerealtime": "+13.208",                 "afterhourschangerealtime": "n/a - n/a",                 "dividendshare": "0.00",                 "lasttradedate": "12/1/2010",                 "tradedate": null,                 "earningsshare": "24.616",                 "errorindicationreturnedforsymbolchangedinvalid": "n/a",                 "epsestimatecurrentyear": "28.79",                 "epsestimatenextyear": "33.37",                 "epsestimatenextquarter": "7.92",                 "dayslow": "562.40",                 "dayshigh": "570.43",                 "yearlow": "433.63",                 "yearhigh": "630.85",                 "holdingsgainpercent": "- - -",                 "annualizedgain": "-",                 "holdingsgain": null,                 "holdingsgainpercentrealtime": "n/a - n/a",                 "holdingsgainrealtime": null,                 "moreinfo": "cnprmiied",                 "orderbookrealtime": "n/a",                 "marketcapitalization": "181.9b",                 "marketcaprealtime": null,                 "ebitda": "11.260b",                 "changefromyearlow": "+135.288",                 "percentchangefromyearlow": "+31.20%",                 "lasttraderealtimewithtime": "n/a - <b>568.918</b>",                 "changepercentrealtime": "n/a - +2.38%",                 "changefromyearhigh": "-61.9319",                 "percebtchangefromyearhigh": "-9.82%",                 "lasttradewithtime": "10:05am - <b>568.918</b>",                 "lasttradepriceonly": "568.918",                 "highlimit": null,                 "lowlimit": null,                 "daysrange": "562.40 - 570.43",                 "daysrangerealtime": "n/a - n/a",                 "fiftydaymovingaverage": "598.612",                 "twohundreddaymovingaverage": "515.244",                 "changefromtwohundreddaymovingaverage": "+53.674",                 "percentchangefromtwohundreddaymovingaverage": "+10.42%",                 "changefromfiftydaymovingaverage": "-29.694",                 "percentchangefromfiftydaymovingaverage": "-4.96%",                 "name": "google inc.",                 "notes": "-",                 "open": null,                 "previousclose": "555.71",                 "pricepaid": null,                 "changeinpercent": "+2.38%",                 "pricesales": "6.45",                 "pricebook": "4.10",                 "exdividenddate": "n/a",                 "peratio": "22.58",                 "dividendpaydate": "n/a",                 "peratiorealtime": null,                 "pegratio": "1.17",                 "priceepsestimatecurrentyear": "19.30",                 "priceepsestimatenextyear": "16.65",                 "symbol": "goog",                 "sharesowned": null,                 "shortratio": "1.30",                 "lasttradetime": "10:05am",                 "tickertrend": " =---+= ",                 "oneyrtargetprice": "669.13",                 "volume": "1279039",                 "holdingsvalue": null,                 "holdingsvaluerealtime": null,                 "yearrange": "433.63 - 630.85",                 "daysvaluechange": "- - +2.38%",                 "daysvaluechangerealtime": "n/a - n/a",                 "stockexchange": "nasdaqnm",                 "dividendyield": null,                 "percentchange": "+2.38%"             },             {                 "symbol": "msft",                 "ask": "25.93",                 "averagedailyvolume": "61957100",                 "bid": "25.92",                 "askrealtime": "25.93",                 "bidrealtime": "25.92",                 "bookvalue": "5.483",                 "change_percentchange": "+0.6625 - +2.62%",                 "change": "+0.6625",                 "commission": null,                 "changerealtime": "+0.6625",                 "afterhourschangerealtime": "n/a - n/a",                 "dividendshare": "0.55",                 "lasttradedate": "12/1/2010",                 "tradedate": null,                 "earningsshare": "2.326",                 "errorindicationreturnedforsymbolchangedinvalid": "n/a",                 "epsestimatecurrentyear": "2.46",                 "epsestimatenextyear": "2.68",                 "epsestimatenextquarter": "0.56",                 "dayslow": "25.56",                 "dayshigh": "25.92",                 "yearlow": "22.73",                 "yearhigh": "31.58",                 "holdingsgainpercent": "- - -",                 "annualizedgain": "-",                 "holdingsgain": null,                 "holdingsgainpercentrealtime": "n/a - n/a",                 "holdingsgainrealtime": null,                 "moreinfo": "cnsprmiied",                 "orderbookrealtime": "n/a",                 "marketcapitalization": "221.8b",                 "marketcaprealtime": null,                 "ebitda": "29.879b",                 "changefromyearlow": "+3.19",                 "percentchangefromyearlow": "+14.03%",                 "lasttraderealtimewithtime": "n/a - <b>25.92</b>",                 "changepercentrealtime": "n/a - +2.62%",                 "changefromyearhigh": "-5.66",                 "percebtchangefromyearhigh": "-17.92%",                 "lasttradewithtime": "10:05am - <b>25.92</b>",                 "lasttradepriceonly": "25.92",                 "highlimit": null,                 "lowlimit": null,                 "daysrange": "25.56 - 25.92",                 "daysrangerealtime": "n/a - n/a",                 "fiftydaymovingaverage": "25.9114",                 "twohundreddaymovingaverage": "25.3427",                 "changefromtwohundreddaymovingaverage": "+0.5773",                 "percentchangefromtwohundreddaymovingaverage": "+2.28%",                 "changefromfiftydaymovingaverage": "+0.0086",                 "percentchangefromfiftydaymovingaverage": "+0.03%",                 "name": "microsoft corpora",                 "notes": "-",                 "open": "25.58",                 "previousclose": "25.2575",                 "pricepaid": null,                 "changeinpercent": "+2.62%",                 "pricesales": "3.29",                 "pricebook": "4.61",                 "exdividenddate": "nov 16",                 "peratio": "10.86",                 "dividendpaydate": "dec  9",                 "peratiorealtime": null,                 "pegratio": "1.04",                 "priceepsestimatecurrentyear": "10.27",                 "priceepsestimatenextyear": "9.42",                 "symbol": "msft",                 "sharesowned": null,                 "shortratio": "1.10",                 "lasttradetime": "10:05am",                 "tickertrend": " +=-=== ",                 "oneyrtargetprice": "32.53",                 "volume": "12466320",                 "holdingsvalue": null,                 "holdingsvaluerealtime": null,                 "yearrange": "22.73 - 31.58",                 "daysvaluechange": "- - +2.62%",                 "daysvaluechangerealtime": "n/a - n/a",                 "stockexchange": "nasdaqnm",                 "dividendyield": "2.18",                 "percentchange": "+2.62%"             }]         }     } }); 

what have there not json. it's json padding. have remove "cbfunc(" , ending ")" able parse json. can use:

var obj = jquery.parsejson('{"name":"john"}'); alert( obj.query.results.quote ); 

to object back.

you can declare function called function cbfunc(o){} , eval() around string not safest way. :)


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -