I have the following method to read a JSON file and convert it to a `Question` object:

```
def self.deserializeQuestions(json)
  if json.nil?
  else
    data = JSON.parse(json)
    questions = Hash.new
    data['questions'].map do |q|
      questions[q['id']] = Question.new(q['id'], q['questionText'])
    end
  end
end

```

The JSON contains questions of different types that correspond to different classes. The types are `'multichoice'`, `'truefalse'`, etc., and the classes are `MultichoiceQuestion`, `TrueFalseQuestion`, etc. All of them inherit from `Question` that still have `id` and `questionText`.

Here is an example of the JSON file I'm using:

```
{ "questions": 
   [
     {
       "type": "multichoice", 
       "id" : 1,
       "questionText": "Scala is...",
        "alternatives": [
           { "text": "alternative 1", "code": 1, "value": 1 },
           { "text": "alternative 2", "code": 2, "value": -0.25 },
           { "text": "alternative 3", "code": 3, "value": -0.25 }
        ]
     },
     {
       "type" : "truefalse",
       "id" : 2,
       "questionText": "Ruby creator is Yukihiro Matsumoto",
       "correct": true,
       "valueOK": 1,
       "valueFailed": -0.25,
     }
   ]
}

```

How can I modify this code to be able to create specific types of `Question` based on the attribute type?