item.loan.id
item.load.name
item.loan.status
item.loan.loan_amount
item.loan.funded_amount
item.loan.basked_amount
item.loan.borrower_count
item.loan.image.id
item.loan.image.template_id
item.loan.activity
item.loan.sector
item.loan.use
item.loan.location.country_code
item.loan.location.country
item.loan.location.town,
item.loan.location.geo.level
item.loan.location.geo.pairs
item.loan.location.geo.type
item.loan.partner_id
item.loan.posted_date
item.loan.description.languages[0]
item.lender.lender_id
item.lender.name
item.lender.whereabouts
item.lender.country_code
item.lender.uid

hint: in firefox using firebug

console.dir(item)

or

console.dir({"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":"GeneralStore","sector":"Retail","use":"To use as additional capital for hersari-sari store","location": {"country_code":"PH","country":"Philippines","town":"Pan- ay ,clarin,misamis Occidental","geo": {"level":"town","pairs":"00","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 deRana","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":"CosmeticsSales","sector":"Retail","use":"to increase her inventory ofcosmetics","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 JoseCA","country_code":"US","uid":"iyad7331"}}]})

Cheers

Paul



On 27-Jun-09, at 6:21 AM, hamburger 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+'&nbsp;<a href="'+
       item.date+'" class="loadMe">'+
       item.loan}).inject(liste);
                });
       name.inject(sidebar); // Einfügen bei id=sidebar
        };
});[/quote]

Thanks for help in advance

Reply via email to