通常我没有使用JSON.NET将JSON反序列化为动态对象的问题。但是,下面的JSON导致错误
无法向Newtonsoft.Json.Linq.JObject添加属性同意。对象上已存在具有相同名称的属性。
我已经针对JSONLint检查了JSON,它看起来是有效的。我在这里缺少什么?
代码
dynamic d = JObject.Parse(jsonString);
JSON
{
"DataFields": {
"preamble": {
},
"applicant": {
"description": {
"count": "1"
},
"details": {
"title": null,
"first_name": null,
"middle_name": null,
"surname": null
},
"property": {
"address": {
"line1": null,
"line2": null,
"line3": null,
"town": null,
"county": null,
"postcode": null
},
"solicitor": {
"name": null,
"address": {
"line1": null,
"line2": null,
"line3": null,
"town": null,
"county": null,
"postcode": null
},
"contact": {
"email": null,
"reference_number": null
}
}
}
},
"boundaries": {
"description": {
},
"location": {
"left": null,
"right": null,
"back": null,
"front": null,
"maintenance": null,
"movement": null,
"movement_details": null,
"ownership": null,
"additional_land": null,
"additional_land_details": null,
"flying_freehold": null,
"flying_freehold_details": null
}
},
"discom": {
"descritpion": {
"question": null,
"details": null
},
"complaint": {
"received": {
"question": null,
"details": null
},
"made": {
"question": null,
"details": null
}
}
},
"notices": {
"sentrec": {
"question": null,
"upload": null,
"details": null
},
"negotiations": {
"question": null,
"details": null
}
},
"guarantees": {
"individual": {
"foundation_newbuild": null,
"foundation_newbuild_upload": null,
"damp_course": null,
"damp_course_upload": null,
"glazing_roofing": null,
"glazing_roofing_upload": null,
"electrical": null,
"electrical_upload": null,
"roofing": null,
"roofing_upload": null,
"infestation": null,
"infestation_upload": null,
"heating": null,
"heating_upload": null,
"underpinning": null,
"underpinning_upload": null,
"other": null,
"other_type": null,
"other_upload": null,
"written_details": null
},
"misc": {
"written_details_upload": null
},
"summary": {
"originals": null,
"claims": null,
"claims_upload": null
}
},
"central_heating": {
"description": {
"installed": null
},
"details": {
"condition": {
"working": null,
"details": null,
"type": null,
"date": null,
"unknown": null,
"completion": null
},
"service": {
"year": null,
"unknown": null,
"copy": null
}
}
},
"services": {
"connected": {
"gas": {
"question": null,
"supplier": {
"name": null,
"phone": null,
"meter": null
}
},
"electric": {
"question": null,
"supplier": {
"name": null,
"phone": null,
"meter": null
}
},
"mainwater": {
"question": null,
"supplier": {
"name": null,
"phone": null,
"stop_cock": null,
"meter": null
}
},
"maindrain": {
"question": null,
"supplier": {
"name": null,
"phone": null,
"meter": null
}
},
"telephone": {
"question": null,
"supplier": {
"name": null,
"phone": null
}
},
"broadband": {
"question": null,
"supplier": {
"name": null,
"phone": null
}
},
"cable": {
"question": null,
"supplier": {
"name": null,
"phone": null
}
},
"satellite_tv": {
"question": null,
"supplier": {
"name": null,
"phone": null
}
}
},
"water": {
"charge": {
"water": {
"latest": null
},
"sewerage": {
"latest": null
}
},
"meter": {
"question": null,
"foul": null,
"surface": null
}
},
"your_property": {
"question": null,
"details": null
},
"neighbours_property": {
"question": null,
"details": null
},
"agreement": {
"question": null,
"copy": null,
"details": null
},
"drain_problems": {
"question": null,
"details": null
},
"septic_cesspit": {
"septic": null,
"sewage": null,
"cesspool": null,
"drainage": {
"septic_tank": null,
"number": null,
"year_last_emptied": null,
"year_installed": null,
"year_treated": null,
"outside_property": null,
"plan_upload": null
}
},
"electricity": {
"question": null,
"tested": {
"year": null,
"copy": null
},
"rewire": {
"question": null,
"certificates": {
"bs7671": null,
"compliance": null,
"completion": null
}
}
}
},
"neighbours": {
"contribution": {
"question": null,
"details": null
},
"repair": {
"question": null,
"details": {
"information": null,
"organiser": null,
"charging": null
}
},
"property": {
"question": null,
"details": {
"information": null,
"objections": null,
"details": null
}
},
"your_property": {
"question": null,
"objections": null,
"details": null
},
"notice": {
"question": null,
"copy": null,
"details": null
}
},
"arrangements": {
"description": {
},
"access": {
"question": null,
"details": null,
"payment": {
"question": null,
"details": null
},
"neighbours": {
"question": null,
"details": {
"details": null
}
},
"other": {
"question": null,
"details": {
"details": null
},
"arrangements": {
"rights_of_light": null,
"rights_of_support": null,
"customary_rights": null,
"mines_and_minerals": null,
"chancel_repair": null,
"take_things": null,
"details": null
}
}
}
},
"occupiers": {
"description": {
"seller_at_property": null,
"vacant": null,
"occupants": null
},
"details": {
"number": null,
"other": {
"name": null,
"age": null
},
"rights": {
"agreed_to_leave": null,
"agreed_to_sign": null,
"vacation_evidence": null,
"tenants_or_lodgers": null,
"tenants_or_lodgers_details": null
}
}
},
"changes": {
"description": {
},
"building": {
"question": null,
"works": {
"details": null,
"year": null,
"permission": {
"question": null,
"upload": null
},
"regulations_approved": {
"question": null,
"upload": null
},
"title": {
"question": null,
"restriction": {
"question": null,
"consent": {
"explanation": null,
"name": null
}
}
},
"insurance_policy": {
"question": null,
"upload": null
}
}
},
"change": {
"use_question": {
"question": null,
"changes_change_use": {
"year": null,
"permission": {
"question": null,
"upload": null
},
"regulations_approved": {
"question": null,
"upload": null
},
"title_restriction_question": {
"question": null,
"changes_change_use_title_restriction": {
"question": null,
"consent": {
"explanation": null,
"contact": null
}
}
},
"insurance_policy": {
"question": null,
"upload": null
}
}
}
},
"sub": {
"question": null,
"division": {
"year": null,
"permission": {
"question": null,
"upload": null
},
"regulations_approved": {
"question": null,
"upload": null
},
"title": {
"question": null,
"restriction": {
"question": null,
"consent": {
"explanation": null,
"contact": null
}
}
},
"insurance_policy": {
"question": null,
"upload": null
}
}
},
"conversionquestion": {
"question": null
},
"conversion": {
"year": null,
"permission": {
"question": null,
"upload": null
},
"regulations_approved": {
"question": null,
"upload": null
},
"title_restrictionquestion": {
"question": null
},
"title_restriction": {
"question": null,
"consent": {
"explanation": null,
"contact": null
}
},
"insurance_policy": {
"question": null,
"upload": null
}
},
"business": {
"question": null,
"activity": {
"year": null,
"permission": {
"question": null,
"upload": null
},
"regulations_approved": {
"question": null,
"upload": null
},
"title": {
"restrictions": null,
"restriction": {
"question": null,
"consent": {
"explanation": null,
"contact": null
}
}
},
"insurance_policy": {
"question": null,
"upload": null
}
}
},
"underpinningquestion": {
"question": null
},
"underpinning": {
"year": null,
"permission": {
"question": null,
"upload": null
},
"regulations_approved": {
"question": null,
"upload": null
},
"title": {
"question": null,
"restriction": {
"question": null,
"consent": {
"explanation": null,
"contact": null
}
}
},
"insurance_policy": {
"question": null,
"upload": null
}
},
"solar": {
"question": null,
"panels": {
"year": null,
"permission": {
"question": null,
"upload": null
},
"regulations_approved": {
"question": null,
"upload": null
},
"title": {
"question": null,
"restriction": {
"question": null,
"consent": {
"explanation": null,
"contact": null
}
}
},
"insurance_policy": {
"question": null,
"upload": null
},
"ownership": {
"question": null
},
"lease": {
"question": null,
"upload": null
}
}
},
"replace": {
"question": null,
"window_roof": {
"year": null,
"permission": {
"question": null,
"upload": null
},
"regulations_approved": {
"question": null,
"upload": null
},
"title": {
"question": null,
"restriction": {
"consent": null,
"consent": {
"explanation": null,
"contact": null
}
}
},
"insurance_policy": {
"question": null,
"upload": null
},
"certificate_regulations": {
"question": null
}
}
},
"air_conditioning": {
"installed": null,
"year": null
},
"satellite_dish": {
"installed": null,
"year": null
},
"central_heating": {
"installed": null,
"details": {
"year": null,
"upload": null
}
},
"unfinished": {
"question": null,
"details": null
},
"breaches": {
"question": null,
"details": null
},
"unresolved": {
"question": null,
"details": null
}
},
"conservatory": {
"description": {
"question": null
},
"details": {
"public": null,
"ground_level": null,
"domestic_purpose": null,
"volume": null,
"height": null,
"boundary": null,
"area": null,
"roof_materials": null,
"safety_glass": null,
"sleeping_accommodation": null,
"access": null,
"heating": null,
"drainage": null,
"build_date": null,
"building_regulations": null,
"building_regulations_copy": null
}
},
"planning": {
"buildingcontrol": {
"private": {
"question": null,
"details": null
},
"listed_building": {
"listed": null,
"conservation": null,
"upload": null
},
"grants": {
"question": null,
"upload": null
},
"gas_installation": {
"question": null,
"upload": null
},
"proposed_development": {
"question": null,
"details": null
},
"treequestion": {
"question": null
},
"tree": {
"question": null,
"local_authority": {
"question": null
}
},
"drain_alterations": {
"question": null,
"year": null
}
}
},
"expenses": {
"property_costs": {
"question": null,
"details": null
}
},
"sale_mechanics": {
"chain": {
"question": null,
"details": null
},
"mortgage": {
"question": null,
"details": null
},
"deposit": {
"question": null
},
"excess": {
"question": null
}
},
"moving": {
"description": {
"special": null,
"date": null
}
},
"environmental": {
"description": {
},
"flooding": {
"question": null,
"details": {
"date_and_location": null,
"ground_water": null,
"sewer_flooding": null,
"surface_water": null,
"coastal_flooding": null,
"river_flooding": null,
"other": null,
"description": null
},
"risk": {
"question": null,
"details": null
}
},
"contamination_land_fill": {
"question": null,
"details": null
},
"property": {
"subsidence": {
"question": null,
"details": null
},
"defective_drains": {
"question": null,
"details": null
},
"damp": {
"question": null,
"details": null
},
"fungal_insect_infestation": {
"question": null,
"details": null
},
"structual_defects": {
"question": null,
"details": null
}
},
"radon": {
"gas": {
"measured": null,
"measurement": {
"copy": null,
"below_action_level": null,
"above_action_level_details": null,
"remedial_action": null,
"remedial_action_details": null
}
}
},
"epc": {
"copy": null
},
"sustainablecertificate": {
"copy": null
},
"greendeal": {
"green_deal": null,
"details": {
"details": null,
"copy": null
}
},
"japaneseknotweed": {
"affected": null,
"plan": {
"in_place": null,
"copy": null
}
}
},
"mining": {
"description": {
"question": null
},
"area": {
"damage": {
"question": null,
"details": null
},
"claim": {
"question": null,
"details": null
},
"previous_owner_claim": {
"question": null,
"details": null
},
"coal_board": {
"upload": null
}
}
},
"general": {
"description": {
"council_tax_band": null,
"council_tax_amount": null,
"keep_telephone_number": null,
"burgled": null
},
"insurance": {
"question": null,
"anomalies": {
"abnormal_premiums": null,
"high_excesses": null,
"unusual_conditions": null,
"refused": null,
"details": null
},
"claims": {
"question": null,
"details": null
}
},
"gift_under_value": {
"question": null,
"details": null
},
"meter_readings": {
"question": null,
"details": null
},
"services_issues": {
"question": null,
"details": null
},
"parking": {
"arrangements": null,
"zonal": null
},
"covenants": {
"question": null,
"details": null
},
"confirm": {
"rubbish_removal": null,
"light_fittings": null,
"removal_care": null,
"keys_and_alarm": null
},
"propertytitle": {
},
"property": {
"locks": {
"question": null,
"details": null
},
"windows": {
"question": null,
"details": null
},
"lavatory": {
"question": null,
"details": null
},
"kitchen": {
"question": null,
"details": null
},
"radiators": {
"question": null,
"details": null
},
"heating_hot_water": {
"question": null,
"details": null
},
"gas_appliances": {
"question": null,
"details": null
},
"gas_electrical_circuitry": {
"question": null,
"details": null
},
"gas_electrical_other": {
"question": null,
"details": null
}
}
},
"uploads": {
"description": {
},
"notices": {
"sentrec": {
}
},
"guarantees": {
"foundation_newbuild_evidence": {
},
"damp_course_evidence": {
},
"glazing_roofing_evidence": {
},
"electrical_evidence": {
},
"roofing_evidence": {
},
"rot_infestation_evidence": {
},
"central_heating_evidence": {
},
"underpinning_evidence": {
},
"other_evidence": {
},
"written_details_evidence": {
}
},
"central_heating": {
"certificate": {
},
"benchmark_scheme_logbook": {
}
},
"services": {
"water_charge": {
},
"sewerage_account": {
},
"septic_cesspit_drainage_regulations": {
},
"septic_cesspit_drainage_plan": {
},
"electricity_certificate": {
},
"electricity_rewire_certificates_bs7671": {
},
"electricity_rewire_certificates_compliance": {
},
"electricity_rewire_certificates_completion": {
}
},
"neighbours": {
"notice": {
}
},
"occupiers": {
"rights_vacation_evidence": {
},
"rights_tenancy_agreement": {
}
},
"changes": {
"building_works": {
"permission": {
},
"regulations_approved": {
},
"insurance_policy": {
},
"listed_building": {
}
},
"change_use": {
"permission": {
},
"regulations_approved": {
},
"insurance_policy": {
},
"listed_building": {
}
},
"sub_division": {
"permission": {
},
"regulations_approved": {
},
"insurance_policy": {
},
"listed_building": {
}
},
"conversion": {
"permission": {
},
"regulations_approved": {
},
"insurance_policy": {
},
"listed_building": {
}
},
"business_activity": {
"permission": {
},
"regulations_approved": {
},
"insurance_policy": {
},
"listed_building": {
}
},
"underpinning": {
"permission": {
},
"regulations_approved": {
},
"insurance_policy": {
},
"listed_building": {
}
},
"solar_panels": {
"permission": {
},
"regulations_approved": {
},
"insurance_policy": {
},
"listed_building": {
},
"lease": {
}
},
"replace_window_roof": {
"permission": {
},
"regulations_approved": {
},
"insurance_policy": {
},
"certificate_regulations": {
},
"listed_building": {
}
},
"central_heating": {
"certificate_regulations": {
}
}
},
"conservatory": {
"details_building_approval": {
}
},
"planning": {
"buildingcontrol_elec_works_certificate": {
},
"buildingcontrol_gas_installation_certificate": {
},
"tree": {
"preservation": {
}
}
},
"environmental": {
"flooding_risk": {
},
"radontestresults": {
},
"epc": {
},
"sustainabilitycertificate": {
}
},
"mining": {
"coal_board_info": {
}
}
},
"instructions": {
"confirmation": {
"authority": null
},
"completed": {
"name": null,
"date": null
}
}
}
}
答案 0 :(得分:2)
我只是通过JSLint运行您发布的JSON - 结构中有一个重复的consent
字段。它位于changes.replace.window_roof.title
对象中。