class Decidim::TermCustomizer::Import::Readers::JSON

Imports any exported JSON file to local objects. It transforms the import data using the parser into the final target objects.

Constants

MIME_TYPE

Public Instance Methods

read_rows() { |keys, index| ... } click to toggle source
# File lib/decidim/term_customizer/import/readers/json.rb, line 14
def read_rows
  json_string = File.read(file)
  ::JSON.parse(json_string).each_with_index do |row, index|
    yield row.keys, index if index.zero?
    yield row.values, index + 1
  end
end