Skip to content

Instantly share code, notes, and snippets.

@r7kamura
Last active November 23, 2020 07:14
Show Gist options
  • Save r7kamura/bbfbb8b345383d10aadd039c7846f4c0 to your computer and use it in GitHub Desktop.
Save r7kamura/bbfbb8b345383d10aadd039c7846f4c0 to your computer and use it in GitHub Desktop.
Ruby script to convert JSON to XML.
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'activesupport'
gem 'builder'
end
require 'active_support/core_ext/array/conversions'
require 'active_support/core_ext/hash/conversions'
require 'json'
puts(
JSON.parse(
STDIN.read
).to_xml(dasherize: false)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment