diff --git a/core/src/core-plugins.ts b/core/src/core-plugins.ts index 7ec429f7c5..60cc5c2db8 100644 --- a/core/src/core-plugins.ts +++ b/core/src/core-plugins.ts @@ -385,6 +385,7 @@ export class CapacitorHttpPluginWeb let data: any; let blob: any; + let responseText: string; switch (responseType) { case 'arraybuffer': case 'blob': @@ -392,7 +393,12 @@ export class CapacitorHttpPluginWeb data = await readBlobAsBase64(blob); break; case 'json': - data = await response.json(); + responseText = await response.text(); + try { + data = JSON.parse(responseText); + } catch (e) { + data = responseText; + } break; case 'document': case 'text':