Example #1
0
 def test_is_json_from_file_works(self):
     data = Json2xml.fromjsonfile('examples/example.json').data
     data_object = Json2xml(data)
     xml_output = data_object.json2xml()
     is_xml = xml_output.XML_ENTITIES
     self.assertEqual(is_xml, 'xml')
Example #2
0
__author__ = 'niko'
from json2xml.json2xml import Json2xml
data = Json2xml.fromurl('https://coderwall.com/vinitcool76.json').data

print ("THE JSON IS ==========================================")
print data

print ("THE XML IS ==========================================")
data_object = Json2xml(data)
print data_object.json2xml()


Example #3
0
 def test_is_json_from_file_works(self):
     data = Json2xml.fromjsonfile('examples/example.json').data
     data_object = Json2xml(data)
     xml_output = data_object.json2xml()
     htmlkeys = xml_output.XML_FORMATTERS.keys()
     self.assertTrue('html' in  htmlkeys)
Example #4
0
 def w(*a, **kw):
     text = f(*a, **kw) or "{}"  # prevent json2xml crashing on empty input
     return Json2xml(readfromstring(text)).to_xml()