How to convert XML String to JSON String in Spark-Scala
Hello Friends, Today I'd like to share the method for conversion of XML data to Json data using Scala. This is done with org.json library which we use to encode or decode JSON data. Input XML : <Summary_Log> <Monitor> <HardwareInfo>FD2F</HardwareInfo> <Id>0</Id> <Monitor_Type>LCD</Monitor_Type> <Vendor_Data>110HL</Vendor_Data> </Monitor> <Processor> <HardwareInfo>FD2F</HardwareInfo> <Id>1</Id> <Used>80</Used> <Utilization>19</Utilization> </Processor> </Summary_Log> Output Json : {"Summary_Log": { "Monitor": { "Monitor_Type": "LCD", "Vendor_Data": "110HL", "HardwareInfo": "FD2F", "Id": 0 }, "Processor": {