try json.load wrapper json.dumps with data.

Em sexta-feira, 7 de outubro de 2016 10:34:38 UTC-3, 黄祥 escreveu:
>
> *anthony solution in stackoverflow that i adapt to my table is *
> return json.dumps([[r.product.name, r.subscription_amount] for r in rows] 
> )
>
> *reproduce*
> "[[\"Dana Ekuitas\", 1.0], [\"Dana Likuid\", 2.0], [\"Dana Lancar\", 3.0]]"
>
> *format that i want to have*
> [['Dana Ekuitas', 1.0 ], ['Dana Likuid', 2.0 ], ['Dana Lancar', 3.0 ]]
>
> *my models*
> db.define_table('product', 
> Field('name'), 
> Field('fund_manager', 'reference fund_manager'), 
> Field('custodian_bank', 'reference custodian_bank'), 
> Field('currency', 'reference currency'), 
> Field('classification'), 
> Field('risk_n_return'), 
> Field('min_subscription', 'double'),
> Field('min_next_subscription', 'double'),
> Field('min_redemption', 'double'),
> Field('subscription_fee', 'double'),
> Field('redemption_fee_1', 'double'),
> Field('redemption_fee_2', 'double'),
> Field('duration', 'integer'),
> format = lambda r: '%s - %s - %s' % (r.name, r.fund_manager.name, 
> r.classification) )
>
> db.define_table('account', 
> Field('account_no'), 
> Field('investor', 'reference investor'), 
> Field('product', 'reference product'), 
> Field('fund_manager', 'reference fund_manager'), 
> Field('custodian_bank', 'reference custodian_bank'), 
> Field('currency', 'reference currency'), 
> Field('selling_agent', 'reference selling_agent'), 
> Field('unit', 'double'),
> Field('nav_date', 'date'),
> Field('nav_per_unit', 'double'),
> Field('balance', 'double'),
> Field('subscription_amount', 'double'),
> Field('subscription_unit', 'double'),
> Field('subscription_fee', 'double'),
> Field('redemption_amount', 'double'),
> Field('redemption_unit', 'double'),
> Field('redemption_fee', 'double'),
> Field('duration_plan', 'integer'),
> Field('redemption_plan'), 
> Field('redemption_date_plan', 'date'),
> Field('redemption_unit_plan', 'double'),
> format = lambda r: '%s %s - %s - %s - %s - %s' % (r.investor.first_name, 
> r.investor.last_name, r.account_no, r.product.name, r.fund_manager.name, 
> r.selling_agent.name) )
>
> thanks and best regards,
> stifan
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to