DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Convert XML To JSON Using Ruby And ActiveSupport

  • submit to reddit
        // Convert XML to JSON using Ruby and ActiveSupport

#! /usr/bin/env ruby

require 'rubygems'
require 'active_support/core_ext'
require 'json'

xml =
json = Hash.from_xml(xml).to_json, 'w+').write json