Thanks for your hints, its exactly that iam looking for. item.loan.use works fine
On 27 Jun., 20:02, rasmusfl0e <[email protected]> wrote: > "loan" is an object - you can't just concatenate it directly onto a > string. You need to pick out each piece of data from the loan object > you want to present: > > var el = new Element('li', {'html': ''+ > item.id+' <a href="'+ > item.date+'" class="loadMe">'+ > item.loan.name + ": " + > item.loan.loan_amount}).inject(liste); > > On Jun 27, 12:21 pm, hamburger <[email protected]> wrote: > > > > > I have a little bit more complex structure of an json array and i dont > > know to grep it. > > Here ist the json-strukture: > > > [code] > > {"lending_actions":[ > > {"id":16113424,"date":"2009-06-26T16:06:13Z","loan":{"id": > > 118782,"name":"Emma Metuda","status":"fundraising","loan_amount": > > 150,"funded_amount":0,"basket_amount":0,"borrower_count":1,"image": > > {"id":344096,"template_id":1},"activity":"General > > Store","sector":"Retail","use":"To use as additional capital for her > > sari-sari store","location": > > {"country_code":"PH","country":"Philippines","town":"Pan- > > ay ,clarin,misamis Occidental","geo":{"level":"town","pairs":"0 > > 0","type":"point"}},"partner_id": > > 126,"posted_date":"2009-06-26T15:50:06Z","description":{"languages": > > ["en","en"]}},"lender": > > {"lender_id":"pedro2672","name":"Pedro","whereabouts":"S. Domingos de > > Rana","country_code":"PT","uid":"pedro2672"}}, > > > {"id":16113423,"date":"2009-06-26T16:06:08Z","loan":{"id": > > 117887,"name":"Olena Popova","status":"fundraising","loan_amount": > > 2000,"funded_amount":0,"basket_amount":0,"borrower_count":1,"image": > > {"id":342327,"template_id":1},"activity":"Cosmetics > > Sales","sector":"Retail","use":"to increase her inventory of > > cosmetics","location": > > {"country_code":"UA","country":"Ukraine","town":"Kherson","geo": > > {"level":"town","pairs":"46.633333 32.6","type":"point"}},"partner_id": > > 26,"posted_date":"2009-06-23T20:30:04Z","description":{"languages": > > ["en","en"]}},"lender":{"lender_id":"iyad7331","name":"Iyad","image": > > {"id":240974,"template_id":1},"whereabouts":"San Jose > > CA","country_code":"US","uid":"iyad7331"}}, > > ... > > [/code] > > > With my code I can grap the ID and date perfect. But how to get loan? > > my code: > > [quote] var request = new Request.JSON({ > > url: path + 'recent.json', > > onComplete: function(jsonObj) { > > addText(jsonObj.lending_actions); > > } > > }).send(); > > > var addText = function(addArchiv) { > > > var name = new Element('h2', {'html': 'Hallo'}); > > > addArchiv.each(function(item) { > > i++; > > var liste = new Element('ul', {'class': > > 'recentlist'}).inject > > (name); > > var el = new Element('li', {'html': ''+ > > item.id+' <a href="'+ > > item.date+'" class="loadMe">'+ > > item.loan}).inject(liste); > > }); > > name.inject(sidebar); // Einfügen bei id=sidebar > > }; > > > });[/quote] > > > Thanks for help in advance- Zitierten Text ausblenden - > > - Zitierten Text anzeigen -
