SyntaxFix
Write A Post
Hire A Developer
Questions
This one-liner also handles nested objects and JSON.stringify them as needed:
JSON.stringify
let qs = Object.entries(obj).map(([k, v]) => `${k}=${encodeURIComponent(typeof (v) === "object" ? JSON.stringify(v) : v)}`).join('&')