Skip to content

Instantly share code, notes, and snippets.

@akshay-bhardwaj
Created February 17, 2016 13:17
Show Gist options
  • Save akshay-bhardwaj/a6a83cfccecdae0dd42a to your computer and use it in GitHub Desktop.
Save akshay-bhardwaj/a6a83cfccecdae0dd42a to your computer and use it in GitHub Desktop.
require 'json'
output = {}
File.open('desk.txt').each do |line|
data = line.split('|')
key = data[0].strip
value = data[1].strip
output[key]=value
end
puts output.to_json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment