Skip to content

Instantly share code, notes, and snippets.

@basmoura
Last active August 29, 2015 14:01
Show Gist options
  • Save basmoura/155b3d8cad251821448b to your computer and use it in GitHub Desktop.
Save basmoura/155b3d8cad251821448b to your computer and use it in GitHub Desktop.
require 'open-uri'
def convert_json_to_object
emp_json = JSON.parse(open("json_url").read))
emp_json.each do |emp|
employee = Employee.new
employee[:name] = emp["name"]
employee[:cpf] = emp["cpf"]
employee[:email] = emp["email"]
employee.save
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment