-2

when i execute this

JSON.parse(ArrayBuffer);

I have this Error : SyntaxError: Unexpected token in JSON at position 0

Thanks for you response

Zaito
  • 11
  • 1
    Arraybuffer is binary data. Json is a text serializer – Alexander May 13 '22 at 17:53
  • Thank for you response, i can know if i can transform binary data to text serializer because i try to get `ArrayBuffer` to `UTF-8` to `JSON`. – Zaito May 13 '22 at 17:56
  • Check https://stackoverflow.com/questions/17191945/conversion-between-utf-8-arraybuffer-and-string – James May 13 '22 at 18:22

1 Answers1

0

Is your question why the error is occurring? This error occurs when we pass an "undefined" value to the JSON.parse method. ArrayBuffer is a binary data type. JSON.parse expects a JSON object to work properly.

dcmswim
  • 108
  • 7