Fixed NPE in json converter + improved error handling for XML parsing