he (for “HTML entities”) is a robust HTML entity encoder/decoder written in JavaScript.
It supports all standardized named character references as per HTML, handles ambiguous ampersands and other edge cases just like a browser would, has an extensive test suite, and handles astral Unicode symbols just fine.
Decodes serialized form data and populates the form with that data. This method works upon text strings in standard URL-encoded notation, arrays containing objects of name/value pairs or objects containing key/value pairs.