XML : Convert XML with . attribute to JSON in java

I have an XML with the attribute <name.first>.
I want to convert this XML to JSON and save it to MongoDB.

I am using org.json.XML to convert it to JSONObject with:

  XML.toJSONObject(xml)    

The converted JSON contains the key: { ... , name.first : ... }, which is not supported with MongoDB.
Is there a way to serialize the XML converter so that the conversion would output something else like name_first ?

No comments:

Post a Comment