Thanks a lot kelly, I wrote the php script and all working fine, http://nitin.tech4you.org/Stock%20Widget.html
thanks again.. regards, Nitin Sawant On May 21, 8:08 pm, Kelly <khall...@gmail.com> wrote: > Brian said that JSON uses a key:value format, but it is really just a > shorthand for Javascript literals. Which means you can easily > represent ordered lists like CSV data as well: > > [ [ 'c', 's', 'v' ], [ 'c', 's', 'v' ], ... ] > > To get around the cross-domain restrictions and to solve your > conversion issue, maybe you should write a script on the server that > pulls the data, caches it, and writes out JSON. > > Assuming you were using PHP on the server, and assuming the PHP > settings allow fopen wrappers for URLs, this would be pretty easy: > > define('DATA_FILE','data.json'); // must be writable > if (file_exists(DATA_FILE) and filemtime(DATA_FILE) > (time() - 900)) > readfile(DATA_FILE); > else { > $fh = fopen('http.../yoururl/data.csv','r'); > $rows = array(); > while($rows[] = fgetcsv($fh)) { } > $json = json_encode($rows); > file_put_contents(DATA_FILE,$json); > echo $json; > fclose($fh); > > } > > I didn't test this code but it should be pretty close. > > On May 20, 7:45 am, brian <bally.z...@gmail.com> wrote: > > > > > There's quite a difference between the two. JSON uses a key: value > > format, while CSV is generally value only > > > On Wed, May 20, 2009 at 6:28 AM, Nitin Sawant <nitin.jays...@gmail.com> > > wrote: > > > > How to convert csv file to json using jquery / javascript??