I'm a bit new to Clojure and wondering how to convert this Enlive Object to JSON Object.
I parsed through a XML file using the parse method as below:
(def xml-parser
(parse "<Vehicle><Model>Toyota</Model><Color>Red</Color><Loans><Reoccuring>Monthly</Reoccuring><Owners><Owner>Bob</Owner></Owners></Loans><Tires><Model>123123</Model><Size>23</Size></Tires><Engine><Model>30065</Model></Engine></Vehicle>"))
And obtained an Enlive Object like so:
{:tag :Vehicle,
:attrs nil,
:content
[{:tag :Model, :attrs nil, :content ["Toyota"]}
{:tag :Color, :attrs nil, :content ["Red"]}
{:tag :Loans,
:attrs nil,
:content
[{:tag :Reoccuring, :attrs nil, :content ["Monthly"]}
{:tag :Owners,
:attrs nil,
:content [{:tag :Owner, :attrs nil, :content ["Bob"]}]}]}
{:tag :Tires,
:attrs nil,
:content
[{:tag :Model, :attrs nil, :content ["123123"]}
{:tag :Size, :attrs nil, :content ["23"]}]}
{:tag :Engine,
:attrs nil,
:content [{:tag :Model, :attrs nil, :content ["30065"]}]}]}
And I would like to be able to convert it into an JSON Object as below:
{:Vehicle {:Model "Toyota"
:Color "Red"
:Loans {:Reoccuring "Monthly"
:Owners {:Owner "Bob"}}
:Tires {
:Model 123123
:Size 23}
:Engine {:Model 30065}}
}
I apologize if the vocabulary used is not completely accurate
I'm having trouble with this step of conversion. Thank you for your help in advance.