json.question do json.id question.id json.question_number question.question_number json.question_title question.question_title json.question_type question.question_type json.is_necessary question.is_necessary if question.question_type == 2 json.max_choices question.max_choices json.min_choices question.min_choices end json.answers do json.array! answers do | a| json.answer_id a.id json.answer_position a.answer_position json.answer_text a.answer_text.nil? ? "other_choices" : a.answer_text ## end end end