Convert XML To JSON Using Ruby And ActiveSupport
Join the DZone community and get the full member experience.
Join For Free// Convert XML to JSON using Ruby and ActiveSupport
#! /usr/bin/env ruby
require 'rubygems'
require 'active_support/core_ext'
require 'json'
xml = File.open(ARGV.first).read
json = Hash.from_xml(xml).to_json
File.open(ARGV.last, 'w+').write json
XML
JSON
Convert (command)
Opinions expressed by DZone contributors are their own.
Comments