Skip to content

Instantly share code, notes, and snippets.

@kalashnikovisme
Last active February 12, 2021 02:29
Show Gist options
  • Save kalashnikovisme/1d12444cbeade455caa60439a276b1b0 to your computer and use it in GitHub Desktop.
Save kalashnikovisme/1d12444cbeade455caa60439a276b1b0 to your computer and use it in GitHub Desktop.
Fix "json" exported from errbit
file = File.open("errors.json").read
lines = []
file.each_line do |line|
line.gsub!(/ObjectId\({1}(.)/, '\1').sub!(/()*\)/, '\1') if line.include? 'ObjectId'
line.gsub!(/ISODate\({1}(.)/, '\1').sub!(/()*\)/, '\1') if line.include? 'ISODate'
lines.push line
end
puts lines
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment