# File lib/json/editor.rb, line 1210
1210:       def read_data(filename)
1211:         open(filename) do |f|
1212:           json = f.read
1213:           check_pretty_printed(json)
1214:           if @encoding && !/^utf8$/i.match(@encoding)
1215:             iconverter = Iconv.new('utf8', @encoding)
1216:             json = iconverter.iconv(json)
1217:           end
1218:           return JSON::parse(json, :max_nesting => false)
1219:         end
1220:       rescue => e
1221:         Editor.error_dialog(self, "Failed to parse JSON file: #{e}!")
1222:         return
1223:       end