Fix warnings from convertToJsonDocument() being called with an empty JSON
In case we get any socket error code like HostNotFoundError or ConnectionRefusedError or UnknownNetworkError (Host unreachable) etc. there won't be any JSON document to parse. In fact this would only happen when there's no network error.
Also avoid calling errorStr() on an empty json object, it gives warnings with empty strings, a bit confusing when debugging.