Skip to content

Instantly share code, notes, and snippets.

@Moligaloo
Created December 2, 2015 13:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Moligaloo/f241f1a81ece6c3da8ec to your computer and use it in GitHub Desktop.
Save Moligaloo/f241f1a81ece6c3da8ec to your computer and use it in GitHub Desktop.
Convert JSON source file to MessagePack file
#!/usr/bin/env ruby
require 'json'
require 'msgpack'
if ARGV.length < 2
puts "#{$PROGRAM_NAME} <json file> <msgpack file>"
exit 1
end
json_file = ARGV[0]
msgpack_file = ARGV[1]
IO.write msgpack_file, (JSON.parse IO.read json_file).to_msgpack
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment