# File lib/json/editor.rb, line 83
    def Editor.model2data(iter)
      return nil if iter.nil?
      case iter.type
      when 'Hash'
        hash = {}
        iter.each { |c| hash[c.content] = Editor.model2data(c.first_child) }
        hash
      when 'Array'
        array = Array.new(iter.n_children)
        iter.each_with_index { |c, i| array[i] = Editor.model2data(c) }
        array
      when 'Key'
        iter.content
      when 'String'
        iter.content
      when 'Numeric'
        content = iter.content
        if /\./.match(content)
          content.to_f
        else
          content.to_i
        end
      when 'TrueClass'
        true
      when 'FalseClass'
        false
      when 'NilClass'
        nil
      else
        fail "Unknown type found in model: #{iter.type}"
      end
    end