Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Convert XML To JSON Using Ruby And ActiveSupport

DZone's Guide to

Convert XML To JSON Using Ruby And ActiveSupport

· ·
Free Resource
// 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
Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}