skip to Main Content
import re
import json
json_pattern = re.search(r'residentSubmitDetails:s*({.*?})s*}', js_code, re.DOTALL)
print(json_pattern)
if json_pattern:
    json_str = json_pattern.group(1)
    json_obj = json.loads(json_str)
    print(json_obj)  

I have a javascript code and I need to convert particular block of line into dictionary/json format. The data I need to convert is {title:"Resident Submitted Details"…} to dictionary.I have attached javascript string. The json_str is the attached string, when it json.loads its showing error "json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)". Is there any solution

{title:"Resident Submitted Details",issueSectionTitle:"Issue",issueDescriptors:{ac__broken__none:"Air Conditioner",air_conditioning__broken__none:"Air Conditioner",air_conditioning__leak__none:"Air Conditioner Leak",air_conditioning__none__none:"Air Conditioner",air_ducts__broken__none:"Broken Air Ducts",alarm__none__none:"Alarm",balcony__none__none:"Balcony Needs Repair",bathtub__crack__none:"Bathtub Damage",bathtub__cracked__none:"Bathtub Damage",bathtub__fiberglass_issue__none:"Fiberglass Issue In Bathtub",bathtub__leak__none:"Bathtub Leak",bathtub__needs_paint__none:"Bathtub Missing Paint",bathtub__peeling__none:"Bathtub Peeling",bathtub__resealing__none:"Bathtub Leak",bees__none__none:"Bees",birds__infestation__none:"Birds",birds__nesting__none:"Birds",birds__none__none:"Birds",breaker__broken__none:"Electrical Breaker",breaker__none__none:"Electrical Breaker",buzzer__broken__none:"Broken Buzzer",cabinet__broken__none:"Broken Cabinet",call_box__broken__none:"Broken Call Box",carbon_monoxide_sensor__broken__none:"Carbon Monoxide Sensor",carbon_monoxide_sensor__none__none:"Carbon Monoxide Sensor",carpet__broken__none:"Carpet",carpet__damaged__none:"Carpet",carpet__dirty__none:"Dirty Carpet",carpet__needs_cleaning__none:"Carpet Needs Cleaning",carpet__needs_repair__none:"Carpet Needs Repair",carpet__none__none:"Carpet",ceiling__broken__none:"Damaged Ceiling",ceiling__collapsed__none:"Ceiling Collapsed",ceiling__crack__none:"Ceiling Damage",ceiling__cracked__none:"Ceiling Damage",ceiling__damaged__none:"Damaged Ceiling",ceiling__leak__none:"Ceiling Leak",ceiling__water_spots__none:"Water Spots On Ceiling",ceiling_fan__needs_to_be_flipped__none:"Ceiling Fan Needs To Be Flipped",closet_door__broken__none:"Broken Closet Door",closet_rod__broken__none:"Closet Rod/Shelving",closet_rod__none__none:"Closet Rod/Shelving",coin_machine__broken__none:"Broken Coin Machine",countertops__broken__none:"Countertop",countertops__damaged__none:"Countertop",countertops__none__none:"Countertop",critters__none__none:"Critter Problem",deck__none__none:"Outdoor Deck/Patio",dishwasher__broken__none:"Dishwasher",dishwasher__none__none:"Dishwasher",door__broken__none:"Door",door__coming_off_hinges__none:"Door Coming Off Hinges",door__does_not_open_or_close__none:"Door Will Not Open Or Close",door__none__none:"Door",door__will_not_close__none:"Door Will Not Close",door__will_not_lock__none:"Door Will Not Lock",door_facing__broken__none:"Broken Door Facing",door_frame__broken__none:"Broken Door Frame",door_frame__build__none:"Door Frame Needs Install",door_frame__needs_install__none:"Door Frame Needs Install",door_handle__broken__none:"Broken Door Handle",door_handle__loose__none:"Loose Door Handle",door_handle__none__none:"Damaged Door Handle",door_knob__none__none:"Damaged Door Knob",door_locks__broken__none:"Broken Door Lock",doorbell__broken__none:"Doorbell/Buzzer",doorbell__none__none:"Doorbell/Buzzer",drain__broken__none:"Broken Drain",drain__clogged__none:"Drain/Pipe Clog",drain__leak__constant_flow:"Drain Leaking (Constant Flow)",drain__leak__none:"Drain Leaking",drain__leak__small_drip:"Drain Leaking (Small Drip)",drain__leak_issues__none:"Drain Leaking",drain__no_water__none:"Drain Issue",drain__none__none:"Broken Drain",drain__not_draining__none:"Drain/Pipe Clog",drain__part_damaged__none:"Cracked/Damaged Drain",drain__rattling__none:"Rattling Drain",drain__ringing_rattling__none:"Rattling Drain",drain__vague__none:"General Drain Issue",drawer__broken__none:"Broken Drawer",driveway__broken__none:"Driveway",driveway__needs_repair__none:"Driveway Needs Repair",driveway__none__none:"Driveway",dryer__broken__none:"Dryer",dryer__none__none:"Dryer",dumpster__broken__none:"Broken Dumpster",electricity__broken__none:"No Electricity",electricity__none__none:"No Electricity",elevator__broken__none:"Elevator",elevator__none__none:"Elevator",elevator__not_working__none:"Elevator",fan__broken__none:"Fan",fan__needs_to_be_flipped__none:"Fan Need To Be Flipped",fan__none__none:"Fan",faucet__broken__none:"Broken Faucet",faucet__leak__constant_flow:"Faucet Leak (Constant Flow)",faucet__leak__none:"Faucet Leak",faucet__leak__small_drip:"Faucet Leak (Small Drip)",faucet__leak_issues__none:"Faucet Leak",faucet__no_water__none:"Faucet Not Running",faucet__none__none:"Broken Faucet",faucet__part_damaged__none:"Damaged Faucet",faucet__rattling__none:"Rattling Faucet",faucet__ringing_rattling__none:"Rattling Faucet",faucet__vague__none:"General Faucet Issue",fence__general_issues__none:"General Faucet Issue",fence__none__none:"Fence/Gate",filter__broken__none:"Air Filter",filter__none__none:"Air Filter",fire__none__none:"Fire",fireplace__broken__none:"Fireplace",fireplace__damaged__none:"Damaged Fireplace",fireplace__none__none:"Fireplace",fireplace__not_working__none:"Fireplace Not Working",fireplace__wont_turn_on__none:"Fireplace Wont Turn On",flooding__none__none:"Flooding",follow_up_eta_2nd_request__none__none:"Follow Up",foundation__issues__none:"Foundation Issues",foundation__none__none:"Damaged Foundation",freezer__broken__none:"Freezer",freezer__missing_parts__none:"Freezer Missing Part",freezer__none__none:"Freezer",fridge__broken__none:"Fridge",fridge__leak__none:"Fridge Leaking",fridge__missing_parts__none:"Fridge Missing Part",fridge__none__none:"Fridge",furniture__broken__bed:"Damaged Bed",furniture__broken__desk:"Damaged Desk",furniture__broken__none:"Furniture",furniture__broken__table:"Damaged Table",furniture__none__none:"Furniture",garage_door__broken__none:"Garage Door",garage_door__broken__not_emergency___none:"Garage Door",garage_door__none__none:"Garage Door",garage_door_keys__locked_out__none:"Garage Door Keys - Locked Out",garbage_disposal__broken__none:"Garbage Disposal",garbage_disposal__none__none:"Garbage Disposal",gas_leak__none__none:"Gas Leak",gate__general_issues__none:"Gate Not Working",gate__none__none:"Gate Not Working",general_leak__none__constant_flow:"General Leak (Constant Flow)",general_leak__none__none:"General Leak",general_leak__none__small_drip:"General Leak (Small drip)",grout__broken__none:"Broken Grout",gym_equipment__broken__none:"Broken Gym Equipment",hard_floors__broken__none:"Broken Hard Floors",hard_floors__bulging__none:"Hard Floors Bulging",hard_floors__coming_loose__none:"Hard Floors Coming Loose",hard_floors__damaged__none:"Hard Floors",hard_floors__holes__none:"Hole In Hard Floors",hard_floors__loose__none:"Loose Hard Floors",hard_floors__none__none:"Hard Floors",hard_surface__bulging__none:"Hard Floors Bulging",hard_surface__coming_loose__none:"Loose Hard Floors",hard_surface__damaged__none:"Hard Floors",hard_surface__holes__none:"Hole In Hard Floors",heater__broken__none:"Heater",heater__none__none:"Heater",hvac__broken__none:"Broken Hvac",hvac__none__none:"Broken Hvac",insects__infestation__ants:"Ants",insects__infestation__bees:"Bees",insects__infestation__cockroaches:"Cockroaches",insects__infestation__spiders:"Spiders",insects__infestation__termites:"Termites",insects__infestation__wasps:"Wasps",internet__broken__none:"Internet",internet__none__none:"Internet",internet__not_working__none:"Internet",keys_access__locked_out__garage_door_keys:"Locked Out Of Garage",keys_access__locked_out__mailbox:"Locked Out Of Mailbox",keys_access__locked_out__none:"Key Access - Locked Out",keys_access__locked_out__remote:"Lost Remote",keys_access__needs_keys__garage_door_keys:"Lost Garage Remote",keys_access__needs_keys__mailbox:"Lost Mailbox Key",keys_access__needs_keys__none:"Need Keys",keys_access__needs_keys__remote:"Need Remote",landscaping__none__none:"Landscaping",landscaping__trees__none:"Landscaping - Trees",light_switch__broken__none:"Broken Light Switch",lights__broken__none:"Lighting",lights__none__none:"Lighting",loose_dog__none__none:"Loose Dog",mailbox__broken__none:"Mailbox",mailbox__locked_out__none:"Mailbox Locked Out",mailbox__none__none:"Mailbox",mice__none__none:"Mice Issue",microwave__broken__none:"Microwave",microwave__none__none:"Microwave",miscellaneous__none__none:"Other Maintenance - Not Listed",mold_moisture_mildew__none__none:"Mold/Mildew",moles__none__none:"Mole Issue",neighbors__noise__none:"Noise Complaint",not_maintenance_related__none__none:"Not Maintenance Related",odor__gas_smell__none:"Gas Smell",odor__other_odor__none:"Foul Odor",outlet__broken__none:"Electrical Outlet",outlet__none__none:"Electrical Outlet",oven__broken__none:"Oven",oven__none__none:"Oven",paint__needs_paint__none:"Need Paint",paint__needs_painting__none:"Paint Needed",paint__none__none:"Paint",paint__peeling__none:"Paint Peeling",paint_drywall__needs_painting__none:"Wall Needs Paint",paint_drywall__peeling__none:"Wall Peeling",paint_drywall__touch_up__none:"Wall Needs Touch Up",parking__none__none:"Parking Issues",pavement__broken__none:"Pavement",pavement__needs_repair__none:"Pavement Needs Repair",pavement__none__none:"Pavement",pests__none__none:"Pests",pipes__clogged__none:"Pipe Clog",pipes__leak__constant_flow:"Pipe Leak (Constant Flow)",pipes__leak__none:"Pipe Leak",pipes__leak__small_drip:"Pipe Leak (Small Drip)",pipes__leak_issues__none:"Pipe Leak",pipes__no_water__none:"No Water",pipes__none__none:"General Pipe Issue",pipes__not_draining__none:"Pipe Clog",pipes__part_damaged__none:"Damaged Pipe",pipes__rattling__none:"Rattling Pipe",pipes__ringing_rattling__none:"Rattling Pipes",pipes__vague__none:"General Pipe Issue",pool__broken__none:"Pool",pool__none__none:"Pool",porch__none__none:"Porch Needs Repair",rain_gutters__broken__none:"Rain Gutters",rain_gutters__damaged__none:"Damaged Rain Gutters",rain_gutters__none__none:"Rain Gutters",rats__none__none:"Rats",remote__locked_out__none:"Missing Remote",rodents__infestation__moles:"Mole/Gopher",rodents__infestation__rats_or_mice:"Rats/Mice",rodents__nesting__moles:"Mole Problem",rodents__nesting__rats_or_mice:"Rat/Mouse Problem",rodents__none__none:"Rodents",roof__general_repair__none:"General Roof Issue",roof__leak__none:"Roof Leak Exterior",roof__leaking__none:"Roof Leak Exterior",roof__missing_shingles__none:"Roof Shingles/Tiles",roof__none__none:"Roof Issue",screens__broken__none:"Screen - Window/Door",screens__dirty__none:"Dirty Screen",screens__missing_parts__none:"Screen Missing Parts",screens__need_cleaning__none:"Dirty Screen",screens__need_removal__none:"Screen Needs Removal",screens__need_screens__none:"Need Screen",screens__needs_cleaning__none:"Dirty Screen",screens__needs_removal__none:"Need Screen Removed",screens__none__none:"Screen - Window/Door",seat__broken__none:"Broken Seat",septic_tank__broken__none:"Septic Tank Issue",septic_tank__none__none:"Septic Tank Issue",sewer__broken__none:"Sewer",sewer__none__none:"Sewer",shelves__broken__none:"Broken Shelves",shower__crack__none:"Shower Tile/Surface Damage",shower__cracked__none:"Shower Tile/Surface Damage",shower__fiberglass_issue__none:"Fiberglass Issue In Shower",shower__leak__none:"Shower Leak",shower__needs_paint__none:"Shower Missing Paint",shower__peeling__none:"Shower Peeling",shower__resealing__none:"Shower Leak",shower_faucet__broken__none:"Broken Shower Faucet",shower_glass__broken__none:"Shower Glass",shower_glass__none__none:"Shower Glass",shower_head__broken__none:"Shower Head",shower_head__none__none:"Shower Head",siding__broken__none:"Broken Siding",siding__build__none:"Needs Siding",siding__needs_install__none:"Sinding Needs Install",sink__crack__none:"Sink Damage",sink__cracked__none:"Sink Damage",sink__fiberglass_issue__none:"Fiberglass Issue In Sink",sink__leak__none:"Sink Leaking",sink__needs_paint__none:"Sink Missing Paint",sink__peeling__none:"Sink Peeling",sink__resealing__none:"Sink Leaking",sliding_doors__broken__none:"Broken Sliding Door",smoke_detector__broken__none:"Smoke Detector",smoke_detector__none__none:"Smoke Detector",snow_service__none__none:"Snow Service",spa__broken__none:"Spa Not Working",sprinklers__broken__none:"Sprinklers",sprinklers__none__none:"Sprinklers",stove__broken__none:"Stove",stove__none__none:"Stove",stucco__broken__none:"Cracked Stucco",stucco__build__none:"Stucco Needs Install",stucco__needs_install__none:"Stucco Needs Install",sump_pump__broken__none:"Sump Pump",sump_pump__none__none:"Sump Pump",thermostat__broken__none:"Thermostat",thermostat__none__none:"Thermostat",tile__broken__none:"Broken Tile",toilet__broken__none:"Broken Toilet",toilet__clogged__chain_not_working:"Toilet Chain Issue",toilet__clogged__none:"Toilet Clog",toilet__clogged__tank_not_filling:"Toilet Tank Not Filling",toilet__none__none:"Broken Toilet",toilet__running_continuously__none:"Toilet Is Running Continuously",toilet__wont_flush__chain_not_working:"Toilet Chain Not Working",toilet__wont_flush__clogged:"Toilet Clogged",toilet__wont_flush__tank_not_filling:"Toilet Tank Not Filling",toilet_lid__broken__none:"Toilet Seat/Lid",toilet_lid__none__none:"Toilet Seat/Lid",toilet_paper_holder__broken__none:"Toilet Paper Holder",toilet_paper_holder__none__none:"Toilet Paper Holder",towel_racks__broken__none:"Towel Rack",towel_racks__none__none:"Towel Rack",trash_can__broken__none:"Trash Can/Dumpster",trash_can__none__none:"Trash Can/Dumpster",trim__broken__none:"Broken Trim",trim__build__none:"Trim Needs Install",trim__needs_install__none:"Trim Needs Install",unit__ants__none:"Ants",unit__bed_bugs__none:"Bed Bugs",unit__bees__none:"Bees",unit__birds__none:"Birds",unit__break_in__none:"Break In",unit__cockroaches__none:"Cockroaches",unit__loose_animal__none:"Loose Animal",unit__moles__none:"Mole/Gopher",unit__rats_or_mice__none:"Rats/Mice",unit__spiders__none:"Spiders",unit__termites__none:"Termites",unit__wasps__none:"Wasps",vent__broken__none:"Broken Vent",wall__broken__none:"Wall Damage",wall__collapsed__none:"Wall Collapsed",wall__damaged__none:"Wall Damage",wall__leak__none:"Wall Leaking",wall__none__none:"Wall Damage",wall__water_spots__none:"Water Spots On Wall",washer__broken__none:"Washer",washer__none__none:"Washer",wasps__none__none:"Wasps",water__gross_color__none:"Water Cloudy or Discolored",water__low_water_pressure__none:"Water Pressure",water__no_water__none:"No Water",water__odor__none:"Water Has Odor",water_filter__broken__none:"Broken Water Filter",water_heater__broken__none:"Water Heater",water_heater__needs_repair__none:"Water Heater",water_heater__none__none:"Water Heater",water_heater__water_temperature__none:"No Hot Water",water_hose__broken__none:"Water Hose Outside",water_hose__none__none:"Water Hose Outside",water_pressure__broken__none:"Water Pressure Issue",water_shut_off_valve__broken__none:"Broken Water Shut Off Valve",water_spigot__broken__none:"Water Faucet Outside",water_spigot__none__none:"Water Faucet Outside",water_temperature__needs_repair__none:"Water Temperature Issue",window_coverings__broken__none:"Broken Window Covering",window_coverings__damaged__none:"Window Blind/Coverings",window_coverings__need_repair__none:"Window Blind/Coverings",window_coverings__none__none:"Window Blind/Coverings",windows__broken__none:"Window",windows__damaged__none:"Window",windows__dirty__none:"Dirty Window",windows__does_not_open_or_close__none:"Window Wont Open/Close",windows__don_t_open__none:"Window Wont Open/Close",windows__missing_parts__none:"Window Missing Parts",windows__need_cleaning__none:"Dirty Window",windows__need_locks__none:"Window Wont Lock",windows__need_re_trimming__none:"Window Needs Trim",windows__need_repair__none:"Window Needs Repair",windows__needs_cleaning__none:"Window Needs Cleaning",windows__needs_retrimming__none:"Window Trim Issue",windows__none__none:"Window",windows__not_functional__none:"Window Not Working",windows__painted_shut__none:"Window Wont Open/Close",windows__re_sealing__none:"Window Trim Issue",windows__resealing__none:"Window Trim Issue",wire__broken__none:"Broken Wire"},triageDetails:{toilet_spill_over:"Toilet spilling over",another_toilet:"Another toilet",water_spots_growing:"Water spots growing",active_leak:"Active leak",containable_leak:"Containable leak",dirty_water:"Sewage backing up",toggle_valve:"Able to turn off water with valve",leak_magnitude:"Magnitude of leak",optional_leak_magnitude:"Magnitude of leak",leak_flooding_to_yard_or_street:"Leak flooding to yard or street",gate_preventing_access:"Gate preventing access",currently_locked_out:"Currently locked out",water_drain_speed:"Drain speed",water_out_entire_home:"Water out for entire home",water_pressure_low_entire_home:"Water pressure low for entire home",contacted_utility_company:"Contacted utility company",gas_smell:"Gas smell",able_to_secure_door:"Able to secure door",leaking_only_when_raining:"Leak occurrence",another_air_conditioner:"Another AC",thermostat_wired_or_batteries:"Thermostat is wired or contains batteries",co_sensor_wired_or_batteries:"CO sensor is wired or contains batteries",smoke_alarm_wired_or_batteries:"Smoke alarm is wired or contains batteries",other_outlets_working:"Other outlets working",manually_open_or_close_door:"Able to manually open or close door",cars_stuck_inside:"Cars stuck inside",primary_entrance:"Primary entrance",power_out_entire_home:"Power out to entire home",called_911:"Called 911",affected_drains:"Multiple drains affected",is_operable:"Is operable",gas_or_electric:"Gas or electric",light_location:"Light location",replaced_bulb:"Replaced bulb",outage_affect_fridge:"Outage affects fridge",appliance_type:"Appliance type",appliance_issue_detail:"Issue with appliance",partial_or_full_outage:"Partial or full outage",another_elevator:"Another elevator",door_entrance_exit:"Door is entrance or exit",tomorrow_weekend_or_holiday:"Tomorrow is a weekend or holiday",maximum_temperature:"Maximum 3-day forecast",minimum_temperature:"Minimum 3-day forecast",sparking_smoking:"Sparking or smoking",lockout_fee:"Tenant accepts lockout fee",hole_in_window:"Hole in window",hot_water:"Hot water",furniture_type:"Furniture type",door_issue:"Door issue",detector_issue:"Smoke detector issue",leak_location:"Location of leak",fridge_cooling:"Fridge is cooling",ac_type:"AC type",cosmetic_or_safety:"Cosmetic or safety",ac_blowing_warm:"AC blowing warm air or no air at all",ac_set_to_cool:"AC set to cool",active_leak_ceiling:"Active ceiling leak",change_ac_filter:"AC filter changed",drain_plunging_or_snaking:"Attempted to clear clog",electric_company:"Contacted the utility company",freezer_affected:"Affecting both the fridge and freezer",garbage_disposal_reset_button:"Pressed the reset button",garbage_disposal_something_inside:"Objects stuck in the garbage disposal",garbage_disposal_unwind:"Unwind with Allen wrench",make_and_model:"Make and model number",prevent_leak_floor_damage:"Leak was contained",radiators_cool:"Radiator is cool to the touch",reset_breakers:"Reset circuit breakers",reset_button_small_appliance:"Reset GFCI outlet",reset_sensors:"Checked batteries",send_us_picture:"Pictures of issue included",toilet_plunging:"Attempted plunging",toilet_shut_off_valve:"Able to turn off the water supply valve",turn_off_water_valve:"Able to turn off the water supply valve",turn_radiators_water_valve:"Able to adjust the water valve",water_company:"Contacted the utility company",water_out_neighbors:"Impacting other areas outside of unit",door_or_remote:"Issue related to remote or door",heater_type:"Type of heater",one_area_confined:"Affected faucets",room_location:"Location of issue",room_location_bath:"Location of issue",water_heater_type:"Type of water heater",heater_blowing_cool:"Blowing air",file_police_report:"File police report",ant_pesticide:"Tried ant spray",pest_location:"Location of pest",home_common_area:"Location of appliance",contacted_emergency_services:"Called 911",leak_when_raining:"Leak only when it's raining",on_behavior:"The behavior when it is turned on",unit_above:"Unit above",thermostat_set_to:"Thermostat is set correctly"},triageDetailBooleanValues:{true:"Yes",false:"No"},triageDetailCustomChoiceValues:{ac_type:{central:"Central air conditioning",wall_unit:"Window or wall AC unit",swamp_cooler:"Swamp cooler",other:"Another air conditioning type"},ac_blowing_warm:{no_air_at_all:"No air at all",blowing_warm_air:"Blowing warm air",not_applicable:"Not Applicable"},heater_type:{central:"Central",radiator:"Radiator",window_wall_unit:"Window/wall unit",other:"Other",not_applicable:"Not Applicable"},cosmetic_or_safety:{cosmetic:"Cosmetic issue",safety:"Safety issue"},water_heater_type:{gas:"Gas",electric:"Electric",boiler:"Boiler",other:"Other"},room_location:{bathroom:"Bathroom",bedroom:"Bedroom",living_room:"Living room",kitchen:"Kitchen",basement:"Basement",other:"Other"},one_area_confined:{one_faucet:"One faucet",all_faucets:"All faucets",not_applicable:"Not Applicable"},door_or_remote:{remote:"Remote",door:"Door",not_applicable:"Not Applicable"},room_location_bath:{master_bathroom:"Primary Bathroom",half_bathroom:"Half Bathroom",guest_bathroom:"Guest Bathroom",other:"Other"},leak_magnitude:{small_drip:"Dripping",constant_flow:"Flowing"},optional_leak_magnitude:{small_drip:"Dripping",constant_flow:"Flowing",not_applicable:"Not Applicable"},water_drain_speed:{slowly:"Draining slowly",none:"Not draining"},leaking_only_when_raining:{constant:"Constant",only_when_raining:"Only when raining"},thermostat_wired_or_batteries:{wired:"Wired",batteries:"Batteries"},co_sensor_wired_or_batteries:{wired:"Wired",batteries:"Batteries"},smoke_alarm_wired_or_batteries:{wired:"Wired",batteries:"Batteries"},affected_drains:{multiple:"Multiple drains",bathtub:"Bathtub",bathroom_sink:"Bathroom sink",kitchen_sink:"Kitchen sink"},gas_or_electric:{gas:"Gas",electric:"Electric"},appliance_type:{dishwasher:"Dishwasher",garbage_disposal:"Garbage Disposal",microwave:"Microwave",oven_or_stove:"Oven or Stove",refrigerator:"Refrigerator",washer_or_dryer:"Washer or Dryer",other:"Other"},appliance_issue_detail:{appliance_does_not_turn_on:"Does not turn on",appliance_not_functioning:"Is on but not functioning properly",appliance_leaking_or_sparking_or_smoking:"Leaking, sparking or smoking",appliance_leaking:"Leaking"},partial_or_full_outage:{partial:"Partial",full:"Full"},furniture_type:{bed:"Bed",desk:"Desk",table:"Table",carpet:"Carpet",sofa:"Sofa",cabinet:"Cabinet",other:"Other"},light_location:{common_area:"Common Area",home:"Home"},door_issue:{does_not_open_or_close:"Does not open or close",coming_off_hinges:"Is coming off the hinges",will_not_lock:"Will not lock",handle_broken:"The handle is broken or loose",lock_broken:"The lock is broken",other:"Other"},active_leak:{active:"Active leak",in_use:"Only leaks when in use",not_applicable:"Not Applicable"},detector_issue:{chirping:"Constantly makes a chirping noise",does_not_turn_on:"Does not turn on",intermittent_beep:"Beeps intermittently"},leak_location:{wall_or_ceiling:"Wall or ceiling",sink_or_faucet:"Sink or faucet",under_sink:"Under sink",toilet:"Toilet",basement:"Basement",other:"Other"},containable_leak:{yes:"Yes",no:"No",not_applicable:"Not Applicable"},able_to_secure_door:{not_applicable:"Not Applicable"},ac_set_to_cool:{not_applicable:"Not Applicable"},active_leak_ceiling:{not_applicable:"Not Applicable"},another_air_conditioner:{not_applicable:"Not Applicable"},another_elevator:{not_applicable:"Not Applicable"},another_toilet:{not_applicable:"Not Applicable"},called_911:{not_applicable:"Not Applicable"},cars_stuck_inside:{not_applicable:"Not Applicable"},change_ac_filter:{not_applicable:"Not Applicable"},contacted_utility_company:{not_applicable:"Not Applicable"},currently_locked_out:{not_applicable:"Not Applicable"},dirty_water:{not_applicable:"Not Applicable"},door_entrance_exit:{not_applicable:"Not Applicable"},drain_plunging_or_snaking:{not_applicable:"Not Applicable"},electric_company:{not_applicable:"Not Applicable"},freezer_affected:{not_applicable:"Not Applicable"},fridge_cooling:{not_applicable:"Not Applicable"},garbage_disposal_reset_button:{not_applicable:"Not Applicable"},garbage_disposal_something_inside:{not_applicable:"Not Applicable",yes:"Yes",no:"No",i_dont_know:"I don't know"},garbage_disposal_unwind:{not_applicable:"Not Applicable"},gas_smell:{not_applicable:"Not Applicable"},gate_preventing_access:{not_applicable:"Not Applicable"},hole_in_window:{not_applicable:"Not Applicable"},hot_water:{not_applicable:"Not Applicable"},is_operable:{not_applicable:"Not Applicable"},leak_flooding_to_yard_or_street:{not_applicable:"Not Applicable"},lockout_fee:{not_applicable:"Not Applicable"},make_and_model:{i_dont_know:"I don't know",not_applicable:"Not Applicable"},manually_open_or_close_door:{not_applicable:"Not Applicable"},on_behavior:{not_applicable:"Not Applicable"},other_outlets_working:{not_applicable:"Not Applicable"},power_out_entire_home:{not_applicable:"Not Applicable"},prevent_leak_floor_damage:{not_applicable:"Not Applicable"},primary_entrance:{not_applicable:"Not Applicable"},radiators_cool:{not_applicable:"Not Applicable"},reset_breakers:{not_applicable:"Not Applicable"},reset_button_small_appliance:{not_applicable:"Not Applicable"},reset_sensors:{not_applicable:"Not Applicable"},send_us_picture:{not_applicable:"Not Applicable"},sparking_smoking:{not_applicable:"Not Applicable"},toggle_valve:{not_applicable:"Not Applicable"},toilet_plunging:{not_applicable:"Not Applicable"},toilet_shut_off_valve:{not_applicable:"Not Applicable"},toilet_spill_over:{not_applicable:"Not Applicable"},tomorrow_weekend_or_holiday:{not_applicable:"Not Applicable"},turn_off_water_valve:{not_applicable:"Not Applicable"},turn_radiators_water_valve:{not_applicable:"Not Applicable"},water_company:{not_applicable:"Not Applicable"},water_spots_growing:{not_applicable:"Not Applicable"},water_out_entire_home:{not_applicable:"Not Applicable"},water_out_neighbors:{not_applicable:"Not Applicable"},water_pressure_low_entire_home:{not_applicable:"Not Applicable"},heater_blowing_cool:{cool_air:"Cool air",no_air_at_all:"No air at all",not_applicable:"Not Applicable"},thermostat_set_to:{not_applicable:"Not Applicable"},unit_above:{not_applicable:"Not Applicable"},leak_when_raining:{not_applicable:"Not Applicable"},ant_pesticide:{not_applicable:"Not Applicable"},file_police_report:{not_applicable:"Not Applicable"},contacted_emergency_services:{not_applicable:"Not Applicable"},pest_location:{kitchen:"Kitchen",bathroom:"Bathroom",bedroom:"Bedroom",living_room:"Living room",outside:"Outside",other:"Other"},home_common_area:{home:"Home",common_area:"Common area",not_applicable:"Not Applicable"}},triageDetailMiscValues:{maximum_temperature:"{{value}}xb0F",minimum_temperature:"{{value}}xb0F",make_and_model:"{{value}}",on_behavior:"{{value}}"}}}

2

Answers


  1. In JSON, an object consists of a name/value pair. Every name has to be a string, which is enclosed by double quotes ("). See RFC 8259 for more information.

    In your example, the name are not enclosed by ".

    I guess what you are really looking for is instead something like chompjs.parse_js_object(), which allows you to transform JavaScript objects into Python data structures.

    See this example:

    import chompjs
    
    js_obj = '{a:1, b:2, c:3}'
    
    py_struct = chompjs.parse_js_object(js_obj)
    

    {‘a’: 1, ‘b’: 2, ‘c’: 3}

    Login or Signup to reply.
  2. This code will work for the given JavaScript code (as a string), but it may not work for others because I have written the logic specifically for the provided string. Feel free to ask for help if you encounter any problems.

    import json
    import re
    
    js_code = """
    var data = {
        residentSubmitDetails: {title:"Resident Submitted Details",issueSectionTitle:"Issue",issueDescriptors:{ac__broken__none:"Air Conditioner",air_conditioning__broken__none:"Air Conditioner",air_conditioning__leak__none:"Air Conditioner Leak",air_conditioning__none__none:"Air Conditioner",air_ducts__broken__none:"Broken Air Ducts",alarm__none__none:"Alarm",balcony__none__none:"Balcony Needs Repair",bathtub__crack__none:"Bathtub Damage",bathtub__cracked__none:"Bathtub Damage",bathtub__fiberglass_issue__none:"Fiberglass Issue In Bathtub",bathtub__leak__none:"Bathtub Leak",bathtub__needs_paint__none:"Bathtub Missing Paint",bathtub__peeling__none:"Bathtub Peeling",bathtub__resealing__none:"Bathtub Leak",bees__none__none:"Bees",birds__infestation__none:"Birds",birds__nesting__none:"Birds",birds__none__none:"Birds",breaker__broken__none:"Electrical Breaker",breaker__none__none:"Electrical Breaker",buzzer__broken__none:"Broken Buzzer",cabinet__broken__none:"Broken Cabinet",call_box__broken__none:"Broken Call Box",carbon_monoxide_sensor__broken__none:"Carbon Monoxide Sensor",carbon_monoxide_sensor__none__none:"Carbon Monoxide Sensor",carpet__broken__none:"Carpet",carpet__damaged__none:"Carpet",carpet__dirty__none:"Dirty Carpet",carpet__needs_cleaning__none:"Carpet Needs Cleaning",carpet__needs_repair__none:"Carpet Needs Repair",carpet__none__none:"Carpet",ceiling__broken__none:"Damaged Ceiling",ceiling__collapsed__none:"Ceiling Collapsed",ceiling__crack__none:"Ceiling Damage",ceiling__cracked__none:"Ceiling Damage",ceiling__damaged__none:"Damaged Ceiling",ceiling__leak__none:"Ceiling Leak",ceiling__water_spots__none:"Water Spots On Ceiling",ceiling_fan__needs_to_be_flipped__none:"Ceiling Fan Needs To Be Flipped",closet_door__broken__none:"Broken Closet Door",closet_rod__broken__none:"Closet Rod/Shelving",closet_rod__none__none:"Closet Rod/Shelving",coin_machine__broken__none:"Broken Coin Machine",countertops__broken__none:"Countertop",countertops__damaged__none:"Countertop",countertops__none__none:"Countertop",critters__none__none:"Critter Problem",deck__none__none:"Outdoor Deck/Patio",dishwasher__broken__none:"Dishwasher",dishwasher__none__none:"Dishwasher",door__broken__none:"Door",door__coming_off_hinges__none:"Door Coming Off Hinges",door__does_not_open_or_close__none:"Door Will Not Open Or Close",door__none__none:"Door",door__will_not_close__none:"Door Will Not Close",door__will_not_lock__none:"Door Will Not Lock",door_facing__broken__none:"Broken Door Facing",door_frame__broken__none:"Broken Door Frame",door_frame__build__none:"Door Frame Needs Install",door_frame__needs_install__none:"Door Frame Needs Install",door_handle__broken__none:"Broken Door Handle",door_handle__loose__none:"Loose Door Handle",door_handle__none__none:"Damaged Door Handle",door_knob__none__none:"Damaged Door Knob",door_locks__broken__none:"Broken Door Lock",doorbell__broken__none:"Doorbell/Buzzer",doorbell__none__none:"Doorbell/Buzzer",drain__broken__none:"Broken Drain",drain__clogged__none:"Drain/Pipe Clog",drain__leak__constant_flow:"Drain Leaking (Constant Flow)",drain__leak__none:"Drain Leaking",drain__leak__small_drip:"Drain Leaking (Small Drip)",drain__leak_issues__none:"Drain Leaking",drain__no_water__none:"Drain Issue",drain__none__none:"Broken Drain",drain__not_draining__none:"Drain/Pipe Clog",drain__part_damaged__none:"Cracked/Damaged Drain",drain__rattling__none:"Rattling Drain",drain__ringing_rattling__none:"Rattling Drain",drain__vague__none:"General Drain Issue",drawer__broken__none:"Broken Drawer",driveway__broken__none:"Driveway",driveway__needs_repair__none:"Driveway Needs Repair",driveway__none__none:"Driveway",dryer__broken__none:"Dryer",dryer__none__none:"Dryer",dumpster__broken__none:"Broken Dumpster",electricity__broken__none:"No Electricity",electricity__none__none:"No Electricity",elevator__broken__none:"Elevator",elevator__none__none:"Elevator",elevator__not_working__none:"Elevator",fan__broken__none:"Fan",fan__needs_to_be_flipped__none:"Fan Need To Be Flipped",fan__none__none:"Fan",faucet__broken__none:"Broken Faucet",faucet__leak__constant_flow:"Faucet Leak (Constant Flow)",faucet__leak__none:"Faucet Leak",faucet__leak__small_drip:"Faucet Leak (Small Drip)",faucet__leak_issues__none:"Faucet Leak",faucet__no_water__none:"Faucet Not Running",faucet__none__none:"Broken Faucet",faucet__part_damaged__none:"Damaged Faucet",faucet__rattling__none:"Rattling Faucet",faucet__ringing_rattling__none:"Rattling Faucet",faucet__vague__none:"General Faucet Issue",fence__general_issues__none:"General Faucet Issue",fence__none__none:"Fence/Gate",filter__broken__none:"Air Filter",filter__none__none:"Air Filter",fire__none__none:"Fire",fireplace__broken__none:"Fireplace",fireplace__damaged__none:"Damaged Fireplace",fireplace__none__none:"Fireplace",fireplace__not_working__none:"Fireplace Not Working",fireplace__wont_turn_on__none:"Fireplace Wont Turn On",flooding__none__none:"Flooding",follow_up_eta_2nd_request__none__none:"Follow Up",foundation__issues__none:"Foundation Issues",foundation__none__none:"Damaged Foundation",freezer__broken__none:"Freezer",freezer__missing_parts__none:"Freezer Missing Part",freezer__none__none:"Freezer",fridge__broken__none:"Fridge",fridge__leak__none:"Fridge Leaking",fridge__missing_parts__none:"Fridge Missing Part",fridge__none__none:"Fridge",furniture__broken__bed:"Damaged Bed",furniture__broken__desk:"Damaged Desk",furniture__broken__none:"Furniture",furniture__broken__table:"Damaged Table",furniture__none__none:"Furniture",garage_door__broken__none:"Garage Door",garage_door__broken__not_emergency___none:"Garage Door",garage_door__none__none:"Garage Door",garage_door_keys__locked_out__none:"Garage Door Keys - Locked Out",garbage_disposal__broken__none:"Garbage Disposal",garbage_disposal__none__none:"Garbage Disposal",gas_leak__none__none:"Gas Leak",gate__general_issues__none:"Gate Not Working",gate__none__none:"Gate Not Working",general_leak__none__constant_flow:"General Leak (Constant Flow)",general_leak__none__none:"General Leak",general_leak__none__small_drip:"General Leak (Small drip)",grout__broken__none:"Broken Grout",gym_equipment__broken__none:"Broken Gym Equipment",hard_floors__broken__none:"Broken Hard Floors",hard_floors__bulging__none:"Hard Floors Bulging",hard_floors__coming_loose__none:"Hard Floors Coming Loose",hard_floors__damaged__none:"Hard Floors",hard_floors__holes__none:"Hole In Hard Floors",hard_floors__loose__none:"Loose Hard Floors",hard_floors__none__none:"Hard Floors",hard_surface__bulging__none:"Hard Floors Bulging",hard_surface__coming_loose__none:"Loose Hard Floors",hard_surface__damaged__none:"Hard Floors",hard_surface__holes__none:"Hole In Hard Floors",heater__broken__none:"Heater",heater__none__none:"Heater",hvac__broken__none:"Broken Hvac",hvac__none__none:"Broken Hvac",insects__infestation__ants:"Ants",insects__infestation__bees:"Bees",insects__infestation__cockroaches:"Cockroaches",insects__infestation__spiders:"Spiders",insects__infestation__termites:"Termites",insects__infestation__wasps:"Wasps",internet__broken__none:"Internet",internet__none__none:"Internet",internet__not_working__none:"Internet",keys_access__locked_out__garage_door_keys:"Locked Out Of Garage",keys_access__locked_out__mailbox:"Locked Out Of Mailbox",keys_access__locked_out__none:"Key Access - Locked Out",keys_access__locked_out__remote:"Lost Remote",keys_access__needs_keys__garage_door_keys:"Lost Garage Remote",keys_access__needs_keys__mailbox:"Lost Mailbox Key",keys_access__needs_keys__none:"Need Keys",keys_access__needs_keys__remote:"Need Remote",landscaping__none__none:"Landscaping",landscaping__trees__none:"Landscaping - Trees",light_switch__broken__none:"Broken Light Switch",lights__broken__none:"Lighting",lights__none__none:"Lighting",loose_dog__none__none:"Loose Dog",mailbox__broken__none:"Mailbox",mailbox__locked_out__none:"Mailbox Locked Out",mailbox__none__none:"Mailbox",mice__none__none:"Mice Issue",microwave__broken__none:"Microwave",microwave__none__none:"Microwave",miscellaneous__none__none:"Other Maintenance - Not Listed",mold_moisture_mildew__none__none:"Mold/Mildew",moles__none__none:"Mole Issue",neighbors__noise__none:"Noise Complaint",not_maintenance_related__none__none:"Not Maintenance Related",odor__gas_smell__none:"Gas Smell",odor__other_odor__none:"Foul Odor",outlet__broken__none:"Electrical Outlet",outlet__none__none:"Electrical Outlet",oven__broken__none:"Oven",oven__none__none:"Oven",paint__needs_paint__none:"Need Paint",paint__needs_painting__none:"Paint Needed",paint__none__none:"Paint",paint__peeling__none:"Paint Peeling",paint_drywall__needs_painting__none:"Wall Needs Paint",paint_drywall__peeling__none:"Wall Peeling",paint_drywall__touch_up__none:"Wall Needs Touch Up",parking__none__none:"Parking Issues",pavement__broken__none:"Pavement",pavement__needs_repair__none:"Pavement Needs Repair",pavement__none__none:"Pavement",pests__none__none:"Pests",pipes__clogged__none:"Pipe Clog",pipes__leak__constant_flow:"Pipe Leak (Constant Flow)",pipes__leak__none:"Pipe Leak",pipes__leak__small_drip:"Pipe Leak (Small Drip)",pipes__leak_issues__none:"Pipe Leak",pipes__no_water__none:"No Water",pipes__none__none:"General Pipe Issue",pipes__not_draining__none:"Pipe Clog",pipes__part_damaged__none:"Damaged Pipe",pipes__rattling__none:"Rattling Pipe",pipes__ringing_rattling__none:"Rattling Pipes",pipes__vague__none:"General Pipe Issue",pool__broken__none:"Pool",pool__none__none:"Pool",porch__none__none:"Porch Needs Repair",rain_gutters__broken__none:"Rain Gutters",rain_gutters__damaged__none:"Damaged Rain Gutters",rain_gutters__none__none:"Rain Gutters",rats__none__none:"Rats",remote__locked_out__none:"Missing Remote",rodents__infestation__moles:"Mole/Gopher",rodents__infestation__rats_or_mice:"Rats/Mice",rodents__nesting__moles:"Mole Problem",rodents__nesting__rats_or_mice:"Rat/Mouse Problem",rodents__none__none:"Rodents",roof__general_repair__none:"General Roof Issue",roof__leak__none:"Roof Leak Exterior",roof__leaking__none:"Roof Leak Exterior",roof__missing_shingles__none:"Roof Shingles/Tiles",roof__none__none:"Roof Issue",screens__broken__none:"Screen - Window/Door",screens__dirty__none:"Dirty Screen",screens__missing_parts__none:"Screen Missing Parts",screens__need_cleaning__none:"Dirty Screen",screens__need_removal__none:"Screen Needs Removal",screens__need_screens__none:"Need Screen",screens__needs_cleaning__none:"Dirty Screen",screens__needs_removal__none:"Need Screen Removed",screens__none__none:"Screen - Window/Door",seat__broken__none:"Broken Seat",septic_tank__broken__none:"Septic Tank Issue",septic_tank__none__none:"Septic Tank Issue",sewer__broken__none:"Sewer",sewer__none__none:"Sewer",shelves__broken__none:"Broken Shelves",shower__crack__none:"Shower Tile/Surface Damage",shower__cracked__none:"Shower Tile/Surface Damage",shower__fiberglass_issue__none:"Fiberglass Issue In Shower",shower__leak__none:"Shower Leak",shower__needs_paint__none:"Shower Missing Paint",shower__peeling__none:"Shower Peeling",shower__resealing__none:"Shower Leak",shower_faucet__broken__none:"Broken Shower Faucet",shower_glass__broken__none:"Shower Glass",shower_glass__none__none:"Shower Glass",shower_head__broken__none:"Shower Head",shower_head__none__none:"Shower Head",siding__broken__none:"Broken Siding",siding__build__none:"Needs Siding",siding__needs_install__none:"Sinding Needs Install",sink__crack__none:"Sink Damage",sink__cracked__none:"Sink Damage",sink__fiberglass_issue__none:"Fiberglass Issue In Sink",sink__leak__none:"Sink Leaking",sink__needs_paint__none:"Sink Missing Paint",sink__peeling__none:"Sink Peeling",sink__resealing__none:"Sink Leaking",sliding_doors__broken__none:"Broken Sliding Door",smoke_detector__broken__none:"Smoke Detector",smoke_detector__none__none:"Smoke Detector",snow_service__none__none:"Snow Service",spa__broken__none:"Spa Not Working",sprinklers__broken__none:"Sprinklers",sprinklers__none__none:"Sprinklers",stove__broken__none:"Stove",stove__none__none:"Stove",stucco__broken__none:"Cracked Stucco",stucco__build__none:"Stucco Needs Install",stucco__needs_install__none:"Stucco Needs Install",sump_pump__broken__none:"Sump Pump",sump_pump__none__none:"Sump Pump",thermostat__broken__none:"Thermostat",thermostat__none__none:"Thermostat",tile__broken__none:"Broken Tile",toilet__broken__none:"Broken Toilet",toilet__clogged__chain_not_working:"Toilet Chain Issue",toilet__clogged__none:"Toilet Clog",toilet__clogged__tank_not_filling:"Toilet Tank Not Filling",toilet__none__none:"Broken Toilet",toilet__running_continuously__none:"Toilet Is Running Continuously",toilet__wont_flush__chain_not_working:"Toilet Chain Not Working",toilet__wont_flush__clogged:"Toilet Clogged",toilet__wont_flush__tank_not_filling:"Toilet Tank Not Filling",toilet_lid__broken__none:"Toilet Seat/Lid",toilet_lid__none__none:"Toilet Seat/Lid",toilet_paper_holder__broken__none:"Toilet Paper Holder",toilet_paper_holder__none__none:"Toilet Paper Holder",towel_racks__broken__none:"Towel Rack",towel_racks__none__none:"Towel Rack",trash_can__broken__none:"Trash Can/Dumpster",trash_can__none__none:"Trash Can/Dumpster",trim__broken__none:"Broken Trim",trim__build__none:"Trim Needs Install",trim__needs_install__none:"Trim Needs Install",unit__ants__none:"Ants",unit__bed_bugs__none:"Bed Bugs",unit__bees__none:"Bees",unit__birds__none:"Birds",unit__break_in__none:"Break In",unit__cockroaches__none:"Cockroaches",unit__loose_animal__none:"Loose Animal",unit__moles__none:"Mole/Gopher",unit__rats_or_mice__none:"Rats/Mice",unit__spiders__none:"Spiders",unit__termites__none:"Termites",unit__wasps__none:"Wasps",vent__broken__none:"Broken Vent",wall__broken__none:"Wall Damage",wall__collapsed__none:"Wall Collapsed",wall__damaged__none:"Wall Damage",wall__leak__none:"Wall Leaking",wall__none__none:"Wall Damage",wall__water_spots__none:"Water Spots On Wall",washer__broken__none:"Washer",washer__none__none:"Washer",wasps__none__none:"Wasps",water__gross_color__none:"Water Cloudy or Discolored",water__low_water_pressure__none:"Water Pressure",water__no_water__none:"No Water",water__odor__none:"Water Has Odor",water_filter__broken__none:"Broken Water Filter",water_heater__broken__none:"Water Heater",water_heater__needs_repair__none:"Water Heater",water_heater__none__none:"Water Heater",water_heater__water_temperature__none:"No Hot Water",water_hose__broken__none:"Water Hose Outside",water_hose__none__none:"Water Hose Outside",water_pressure__broken__none:"Water Pressure Issue",water_shut_off_valve__broken__none:"Broken Water Shut Off Valve",water_spigot__broken__none:"Water Faucet Outside",water_spigot__none__none:"Water Faucet Outside",water_temperature__needs_repair__none:"Water Temperature Issue",window_coverings__broken__none:"Broken Window Covering",window_coverings__damaged__none:"Window Blind/Coverings",window_coverings__need_repair__none:"Window Blind/Coverings",window_coverings__none__none:"Window Blind/Coverings",windows__broken__none:"Window",windows__damaged__none:"Window",windows__dirty__none:"Dirty Window",windows__does_not_open_or_close__none:"Window Wont Open/Close",windows__don_t_open__none:"Window Wont Open/Close",windows__missing_parts__none:"Window Missing Parts",windows__need_cleaning__none:"Dirty Window",windows__need_locks__none:"Window Wont Lock",windows__need_re_trimming__none:"Window Needs Trim",windows__need_repair__none:"Window Needs Repair",windows__needs_cleaning__none:"Window Needs Cleaning",windows__needs_retrimming__none:"Window Trim Issue",windows__none__none:"Window",windows__not_functional__none:"Window Not Working",windows__painted_shut__none:"Window Wont Open/Close",windows__re_sealing__none:"Window Trim Issue",windows__resealing__none:"Window Trim Issue",wire__broken__none:"Broken Wire"},triageDetails:{toilet_spill_over:"Toilet spilling over",another_toilet:"Another toilet",water_spots_growing:"Water spots growing",active_leak:"Active leak",containable_leak:"Containable leak",dirty_water:"Sewage backing up",toggle_valve:"Able to turn off water with valve",leak_magnitude:"Magnitude of leak",optional_leak_magnitude:"Magnitude of leak",leak_flooding_to_yard_or_street:"Leak flooding to yard or street",gate_preventing_access:"Gate preventing access",currently_locked_out:"Currently locked out",water_drain_speed:"Drain speed",water_out_entire_home:"Water out for entire home",water_pressure_low_entire_home:"Water pressure low for entire home",contacted_utility_company:"Contacted utility company",gas_smell:"Gas smell",able_to_secure_door:"Able to secure door",leaking_only_when_raining:"Leak occurrence",another_air_conditioner:"Another AC",thermostat_wired_or_batteries:"Thermostat is wired or contains batteries",co_sensor_wired_or_batteries:"CO sensor is wired or contains batteries",smoke_alarm_wired_or_batteries:"Smoke alarm is wired or contains batteries",other_outlets_working:"Other outlets working",manually_open_or_close_door:"Able to manually open or close door",cars_stuck_inside:"Cars stuck inside",primary_entrance:"Primary entrance",power_out_entire_home:"Power out to entire home",called_911:"Called 911",affected_drains:"Multiple drains affected",is_operable:"Is operable",gas_or_electric:"Gas or electric",light_location:"Light location",replaced_bulb:"Replaced bulb",outage_affect_fridge:"Outage affects fridge",appliance_type:"Appliance type",appliance_issue_detail:"Issue with appliance",partial_or_full_outage:"Partial or full outage",another_elevator:"Another elevator",door_entrance_exit:"Door is entrance or exit",tomorrow_weekend_or_holiday:"Tomorrow is a weekend or holiday",maximum_temperature:"Maximum 3-day forecast",minimum_temperature:"Minimum 3-day forecast",sparking_smoking:"Sparking or smoking",lockout_fee:"Tenant accepts lockout fee",hole_in_window:"Hole in window",hot_water:"Hot water",furniture_type:"Furniture type",door_issue:"Door issue",detector_issue:"Smoke detector issue",leak_location:"Location of leak",fridge_cooling:"Fridge is cooling",ac_type:"AC type",cosmetic_or_safety:"Cosmetic or safety",ac_blowing_warm:"AC blowing warm air or no air at all",ac_set_to_cool:"AC set to cool",active_leak_ceiling:"Active ceiling leak",change_ac_filter:"AC filter changed",drain_plunging_or_snaking:"Attempted to clear clog",electric_company:"Contacted the utility company",freezer_affected:"Affecting both the fridge and freezer",garbage_disposal_reset_button:"Pressed the reset button",garbage_disposal_something_inside:"Objects stuck in the garbage disposal",garbage_disposal_unwind:"Unwind with Allen wrench",make_and_model:"Make and model number",prevent_leak_floor_damage:"Leak was contained",radiators_cool:"Radiator is cool to the touch",reset_breakers:"Reset circuit breakers",reset_button_small_appliance:"Reset GFCI outlet",reset_sensors:"Checked batteries",send_us_picture:"Pictures of issue included",toilet_plunging:"Attempted plunging",toilet_shut_off_valve:"Able to turn off the water supply valve",turn_off_water_valve:"Able to turn off the water supply valve",turn_radiators_water_valve:"Able to adjust the water valve",water_company:"Contacted the utility company",water_out_neighbors:"Impacting other areas outside of unit",door_or_remote:"Issue related to remote or door",heater_type:"Type of heater",one_area_confined:"Affected faucets",room_location:"Location of issue",room_location_bath:"Location of issue",water_heater_type:"Type of water heater",heater_blowing_cool:"Blowing air",file_police_report:"File police report",ant_pesticide:"Tried ant spray",pest_location:"Location of pest",home_common_area:"Location of appliance",contacted_emergency_services:"Called 911",leak_when_raining:"Leak only when it's raining",on_behavior:"The behavior when it is turned on",unit_above:"Unit above",thermostat_set_to:"Thermostat is set correctly"},triageDetailBooleanValues:{true:"Yes",false:"No"},triageDetailCustomChoiceValues:{ac_type:{central:"Central air conditioning",wall_unit:"Window or wall AC unit",swamp_cooler:"Swamp cooler",other:"Another air conditioning type"},ac_blowing_warm:{no_air_at_all:"No air at all",blowing_warm_air:"Blowing warm air",not_applicable:"Not Applicable"},heater_type:{central:"Central",radiator:"Radiator",window_wall_unit:"Window/wall unit",other:"Other",not_applicable:"Not Applicable"},cosmetic_or_safety:{cosmetic:"Cosmetic issue",safety:"Safety issue"},water_heater_type:{gas:"Gas",electric:"Electric",boiler:"Boiler",other:"Other"},room_location:{bathroom:"Bathroom",bedroom:"Bedroom",living_room:"Living room",kitchen:"Kitchen",basement:"Basement",other:"Other"},one_area_confined:{one_faucet:"One faucet",all_faucets:"All faucets",not_applicable:"Not Applicable"},door_or_remote:{remote:"Remote",door:"Door",not_applicable:"Not Applicable"},room_location_bath:{master_bathroom:"Primary Bathroom",half_bathroom:"Half Bathroom",guest_bathroom:"Guest Bathroom",other:"Other"},leak_magnitude:{small_drip:"Dripping",constant_flow:"Flowing"},optional_leak_magnitude:{small_drip:"Dripping",constant_flow:"Flowing",not_applicable:"Not Applicable"},water_drain_speed:{slowly:"Draining slowly",none:"Not draining"},leaking_only_when_raining:{constant:"Constant",only_when_raining:"Only when raining"},thermostat_wired_or_batteries:{wired:"Wired",batteries:"Batteries"},co_sensor_wired_or_batteries:{wired:"Wired",batteries:"Batteries"},smoke_alarm_wired_or_batteries:{wired:"Wired",batteries:"Batteries"},affected_drains:{multiple:"Multiple drains",bathtub:"Bathtub",bathroom_sink:"Bathroom sink",kitchen_sink:"Kitchen sink"},gas_or_electric:{gas:"Gas",electric:"Electric"},appliance_type:{dishwasher:"Dishwasher",garbage_disposal:"Garbage Disposal",microwave:"Microwave",oven_or_stove:"Oven or Stove",refrigerator:"Refrigerator",washer_or_dryer:"Washer or Dryer",other:"Other"},appliance_issue_detail:{appliance_does_not_turn_on:"Does not turn on",appliance_not_functioning:"Is on but not functioning properly",appliance_leaking_or_sparking_or_smoking:"Leaking, sparking or smoking",appliance_leaking:"Leaking"},partial_or_full_outage:{partial:"Partial",full:"Full"},furniture_type:{bed:"Bed",desk:"Desk",table:"Table",carpet:"Carpet",sofa:"Sofa",cabinet:"Cabinet",other:"Other"},light_location:{common_area:"Common Area",home:"Home"},door_issue:{does_not_open_or_close:"Does not open or close",coming_off_hinges:"Is coming off the hinges",will_not_lock:"Will not lock",handle_broken:"The handle is broken or loose",lock_broken:"The lock is broken",other:"Other"},active_leak:{active:"Active leak",in_use:"Only leaks when in use",not_applicable:"Not Applicable"},detector_issue:{chirping:"Constantly makes a chirping noise",does_not_turn_on:"Does not turn on",intermittent_beep:"Beeps intermittently"},leak_location:{wall_or_ceiling:"Wall or ceiling",sink_or_faucet:"Sink or faucet",under_sink:"Under sink",toilet:"Toilet",basement:"Basement",other:"Other"},containable_leak:{yes:"Yes",no:"No",not_applicable:"Not Applicable"},able_to_secure_door:{not_applicable:"Not Applicable"},ac_set_to_cool:{not_applicable:"Not Applicable"},active_leak_ceiling:{not_applicable:"Not Applicable"},another_air_conditioner:{not_applicable:"Not Applicable"},another_elevator:{not_applicable:"Not Applicable"},another_toilet:{not_applicable:"Not Applicable"},called_911:{not_applicable:"Not Applicable"},cars_stuck_inside:{not_applicable:"Not Applicable"},change_ac_filter:{not_applicable:"Not Applicable"},contacted_utility_company:{not_applicable:"Not Applicable"},currently_locked_out:{not_applicable:"Not Applicable"},dirty_water:{not_applicable:"Not Applicable"},door_entrance_exit:{not_applicable:"Not Applicable"},drain_plunging_or_snaking:{not_applicable:"Not Applicable"},electric_company:{not_applicable:"Not Applicable"},freezer_affected:{not_applicable:"Not Applicable"},fridge_cooling:{not_applicable:"Not Applicable"},garbage_disposal_reset_button:{not_applicable:"Not Applicable"},garbage_disposal_something_inside:{not_applicable:"Not Applicable",yes:"Yes",no:"No",i_dont_know:"I don't know"},garbage_disposal_unwind:{not_applicable:"Not Applicable"},gas_smell:{not_applicable:"Not Applicable"},gate_preventing_access:{not_applicable:"Not Applicable"},hole_in_window:{not_applicable:"Not Applicable"},hot_water:{not_applicable:"Not Applicable"},is_operable:{not_applicable:"Not Applicable"},leak_flooding_to_yard_or_street:{not_applicable:"Not Applicable"},lockout_fee:{not_applicable:"Not Applicable"},make_and_model:{i_dont_know:"I don't know",not_applicable:"Not Applicable"},manually_open_or_close_door:{not_applicable:"Not Applicable"},on_behavior:{not_applicable:"Not Applicable"},other_outlets_working:{not_applicable:"Not Applicable"},power_out_entire_home:{not_applicable:"Not Applicable"},prevent_leak_floor_damage:{not_applicable:"Not Applicable"},primary_entrance:{not_applicable:"Not Applicable"},radiators_cool:{not_applicable:"Not Applicable"},reset_breakers:{not_applicable:"Not Applicable"},reset_button_small_appliance:{not_applicable:"Not Applicable"},reset_sensors:{not_applicable:"Not Applicable"},send_us_picture:{not_applicable:"Not Applicable"},sparking_smoking:{not_applicable:"Not Applicable"},toggle_valve:{not_applicable:"Not Applicable"},toilet_plunging:{not_applicable:"Not Applicable"},toilet_shut_off_valve:{not_applicable:"Not Applicable"},toilet_spill_over:{not_applicable:"Not Applicable"},tomorrow_weekend_or_holiday:{not_applicable:"Not Applicable"},turn_off_water_valve:{not_applicable:"Not Applicable"},turn_radiators_water_valve:{not_applicable:"Not Applicable"},water_company:{not_applicable:"Not Applicable"},water_spots_growing:{not_applicable:"Not Applicable"},water_out_entire_home:{not_applicable:"Not Applicable"},water_out_neighbors:{not_applicable:"Not Applicable"},water_pressure_low_entire_home:{not_applicable:"Not Applicable"},heater_blowing_cool:{cool_air:"Cool air",no_air_at_all:"No air at all",not_applicable:"Not Applicable"},thermostat_set_to:{not_applicable:"Not Applicable"},unit_above:{not_applicable:"Not Applicable"},leak_when_raining:{not_applicable:"Not Applicable"},ant_pesticide:{not_applicable:"Not Applicable"},file_police_report:{not_applicable:"Not Applicable"},contacted_emergency_services:{not_applicable:"Not Applicable"},pest_location:{kitchen:"Kitchen",bathroom:"Bathroom",bedroom:"Bedroom",living_room:"Living room",outside:"Outside",other:"Other"},home_common_area:{home:"Home",common_area:"Common area",not_applicable:"Not Applicable"}
    };
    """
    
    json_pattern = re.search(r'residentSubmitDetails:s*({.*?})s*}', js_code, re.DOTALL)
    
    if json_pattern:
        json_string = json_pattern.group(1)
    
        # Step 1: Add missing quotes to keys (if any)
        json_string = re.sub(r'(?<!["w])(w+)(s*):', r'"1":', json_string)
    
        # Step 2: Ensure proper closing of braces and brackets
        open_braces = json_string.count('{')
        close_braces = json_string.count('}')
    
        if open_braces > close_braces:
            json_string += '}' * (open_braces - close_braces)
        elif close_braces > open_braces:
            json_string = '{' * (close_braces - open_braces) + json_string
    
        try:
            json_obj = json.loads(json_string)
            print(json_obj)
        except json.JSONDecodeError as e:
            print(f"JSON decode error: {e}")
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search