Just access the key as
obj["educations"]["values"].first["startDate"]["year"]
# above is answer if there is always one array inside `obj["educations"]["values"]`
For multiple arrays's
year = []
obj["educations"]["values"].each do |object|
year << object["startDate"]["year"] if !object["startDate"].blank? and !object["startDate"]["year"].blank?
end
update :
If you want to add attributes to the
@user_education = Education.new
@user_education.start_date = value['startDate']['year'] if !value['startDate'].blank? and !value['startDate']['year'].blank?
@user_education.education_id = value['id'] if !value['id'].blank?
@user_education.school_name = value['schoolName'] if !value['schoolName'].blank?
Similarly for any other attribute..
obj["educations"]["values"].each do |value|
@user_education = Education.new("education_id" => value['id'], "school_name" => value['schoolName'])
@user_education.start_date = value["startDate"]["year"] if !value["startDate"].blank? and !object["startDate"]["year"].blank?
@user_education.save! #To save the object
end