1 year ago

#331780

test-img

happy_story

How to deconstruct a parameter that contains a special character?

I am using querysString.parse to deconstruct the URL parameters, and some of them have brackets [].

This is part of the string that I am deconstructing title=wasabi&calories=50&nutrients%5BCA%5D=500

nutrients%5BCA%5D this is the parameter I need to deconstruct, but I don't know how to escape the special characters. I know I have to rename it, but I need to access it first!

const { title, nutrients%5BCA%5D : nutritiant  } = querysString.parse(location.search)

Any ideas how do I do that?

javascript

escaping

destructuring

query-string

0 Answers

Your Answer

Accepted video resources