Support JSON-based web services

If the JSON-based web service works, but does not reply correctly,
automatically fall back onto the XML-based web service.
Fixes #1.
Support JSON-based web services

Part 2