NOTE: I have asked a question before and got marked as duplicate with a link, the answers in the link were for if you had the full URL, as I am asking just for if I have just the query.
In node.js I have a string that looks like this: "color=green&name=Joey&age=126" and want to turn it into an object like this {color:"green",name:"Joey",age:"126"}. This string is received via the POST method. Here is what I have tried and which does not work.
var post = "color=lime+green&name=Joey&age=126";
var parsed = JSON.parse('{"' + post.replace(/=/g, '":"').replace(/&/g, '","') + '"}');
console.log(parsed);
It would help me a lot if I could get a proper and safe way to do this. Also, because of how I have set up my node, I can't use any modules other than HTTP, fs, and URL.