skip to Main Content

Stream writing to a JSON file

I am implementing a JSON export functionality in my project. Earlier, I was building the JSON in memory (by storing the data in structs) and writing them to the target file using serde_json::to_string(data). But now the JSON structure is getting…

VIEW QUESTION

How to convert large active record data to json format – laptop get stucked and get hang during data.to_json – export, import in ROR

user_mails = UserMail.all data = {user_mails: user_mails} File.open("demo_data.json", "w") { |f| f.write data.to_json } json_data['user_mails'].each do |data| UserMail.where(data).first_or_create! end When i trying this my system get stuck and get hang then i need to restart my system, i found that…

VIEW QUESTION
Back To Top
Search