如何在Python中将orderdict转换成json?

时间:2019-02-14 13:57:35

标签: django python-3.x django-serializer

如何将以下orderedict转换为常规json?在python中?

  

[OrderedDict([('ins_short_name','MI'),('受益人',[]),   ('benefit',65),('pcp',[]),('benefit_rates',216),   ('added_dependent',[]),('removed_dependent',[]),('ins_name',   “医疗保险”),(“计划”,{'carrier_logo':   'How to create a DateTime equal to 15 minutes ago?',   'plan_type':'HMO','creation_time':'2019-02-11T06:21:21.743369Z',   'plan_info_details':'','rx_coverage':'11','id':65,'co_pay':   '11','contribution_interval':无,'updation_time':   '2019-02-11T06:21:21.743808Z','benefit_display_name':'Mi1 HMO',   'carrier':1,'status':False,'carrier_name':'NHP',   'rx_information':无,'voluntary':False,'deductible':'11`',   'hsa_qualified_wrap_plan':False,'benefit':65,   'terms_and_conditions':无,'maximum_contribution':无,   'hsa_qualified_base_plan':错误,'primary_care_physician':错误,   'plan_info':''}),('dependent',[]),('questions',   [OrderedDict([('question',1),('question_type','radio'),   ('identifier','Q1'),('ref',[Decimal('1.00')])]),   OrderedDict([[''question',4),('question_type','plan'),   ('identifier','Q4'),('ref',[Decimal('216.00')])])))))))),)   OrderedDict([('ins_short_name','AI'),('受益人',   [OrderedDict([[''id',365),('first_name','rer'),('last_name',   'ere'),('relation','Spouse'),('other_relation',无),('_ type',   'Primary'),('percentage','100'),('benefit',66),('enrollment',   357),('creation_time','2019-02-14T12:04:00.676078Z'),   ('updation_time','2019-02-14T12:04:33.475164Z')])))()('benefit',66),   ('pcp',[]),('benefit_rates',无),('added_dependent',[]),   ('removed_dependent',[]),('ins_name','辅助保险'),   (“计划”,{'carrier_logo':   'How to create a DateTime equal to 15 minutes ago?',   'plan_type':'其他','creation_time':'2019-02-11T06:24:32.322178Z',   'plan_info_details':'','rx_coverage':'','id':66,'co_pay':'',   'contribution_interval':无,'updation_time':   '2019-02-11T06:24:32.322541Z','benefit_display_name':'Ai名称',   'carrier':1,'status':False,'carrier_name':'NHP',   'rx_information':无,'voluntary':true,'deductible':'',   'hsa_qualified_wrap_plan':False,'benefit':66,   'terms_and_conditions':无,'maximum_contribution':无,   'hsa_qualified_base_plan':错误,'primary_care_physician':错误,   'plan_info':''}),('dependent',[]),('questions',   [OrderedDict([('question',12),('question_type','radio'),   ('identifier','Q12'),('ref',[Decimal('10 .00')])]])))))))))

0 个答案:

没有答案