--- /dev/null
+#!/usr/bin/python3
+import xmltodict
+import json
+import sys
+
+try:
+ file = sys.argv[1]
+except:
+ print("Usage: " + sys.argv[0] + " <diameter xml file>")
+ sys.exit(1)
+
+try:
+ with open(file, 'r') as myfile:
+ xml = myfile.read()
+except:
+ print("ERROR reading '" + file + "'")
+ sys.exit(1)
+
+# although default attribute prefix is '@', anyway we will
+# force the value just in case xmltodict implementation
+# changes. The anna::core::functions::json2xml helper,
+# assumes this prefix in order to work properly.
+my_dict=xmltodict.parse(xml, attr_prefix='@')
+json_data=json.dumps(my_dict, indent=3, sort_keys=True)
+print(json_data)