正在将 xml 文件转换为 json,它会引发错误
The document "some xml data" does not have a valid root.
我正在使用 json gem 进行转换,我的代码是
require 'json'
scheduledoc = "xmlfile"
scheduleData = Hash.from_xml(scheduleDoc).to_json
puts "schedule json #{scheduleData}
如何在rails中将xml转换为json。