private static void WriteField(Utf8JsonWriter writer, Dictionary <obj_f, object> properties, obj_f field) { // Special handling that spans different fields switch (field) { case obj_f.permanent_mods: writer.WritePropertyName("permanent_mod_args"); WriteConditions(writer, obj_f.permanent_mods, obj_f.permanent_mod_data, properties); break; case obj_f.permanent_mod_data: // Handled by permanent_mods break; case obj_f.item_pad_wielder_condition_array: writer.WritePropertyName("item_wielder_conditions"); WriteConditions(writer, obj_f.item_pad_wielder_condition_array, obj_f.item_pad_wielder_argument_array, properties); break; case obj_f.item_pad_wielder_argument_array: // Handled by item_pad_wielder_condition_array break; case obj_f.npc_standpoints: WriteNpcStandpoints(writer, properties); break; case obj_f.armor_flags: WriteArmorFlags(writer, (ArmorFlag)(int)properties[field]); break; default: writer.WriteField(field, properties[field]); break; } }