0

I have this value from a tag in the DOM

let r = "/tools/notes?addNote=%7B%22anchorData%22%3A%7B%22selection%22%3A%7B%22text%22%3A%22classical%22%2C%22version%22%3A%222015-11-11T00%3A29%3A39Z%22%2C%22resource%22%3A%22LLS%3ANSBT15%22%2C%22resourceTitle%22%3A%22Dominion%20and%20Dynasty%3A%20A%20Biblical%20Theology%20of%20the%20Hebrew%20Bible%22%2C%22textRanges%22%3A%5B%7B%22offset%22%3A86916%2C%22length%22%3A9%7D%5D%7D%7D%2C%22shouldAddNewNote%22%3Atrue%7D"
r = decodeURI(r.split('=')[1])

//error here 
r = JSON.parse(r)

I want to get the word "classical", so I need to decode and parse it to access it like an object like anchorData.selection.text

but I get an error of Unexpected token % in JSON

What have I done wrong?

akibo
  • 625
  • 11
  • 22

0 Answers0