Skip to content

Instantly share code, notes, and snippets.

@jahan-paisley
Last active December 14, 2017 22:52
Show Gist options
  • Save jahan-paisley/b9f68156f79908d0d20cb45788d7b2f5 to your computer and use it in GitHub Desktop.
Save jahan-paisley/b9f68156f79908d0d20cb45788d7b2f5 to your computer and use it in GitHub Desktop.
//This is how the data looks like at the begginning
//rejection.data: Blob(54) {size: 54, type: "application/json"}
var arrayBuffer;
var fileReader = new FileReader();
fileReader.onload = function() {
arrayBuffer = this.result;
};
fileReader.readAsArrayBuffer(rejection.data);
var dec= new TextDecoder("utf-8");
var jsonStr= dec.decode(arrayBuffer);
var jsonObj= JSON.parse(jsonStr);
//This is the result: "{"message":"","title":null,"status":500,"code":"1001"}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment