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
โ
Opinions expressed by DZone contributors are their own.
Comments