Added ability to use JSON instead of XML