node string to json

// Step 1: Require the 'querystring' module
const queryString = require('querystring');

// Step 2: Define a string containing URL-encoded query parameters
const encodedString = 'name=John&age=30&city=NewYork';

// Step 3: Use the 'querystring.parse' method to convert the string to a JSON object
const jsonObject = queryString.parse(encodedString);

// Step 4: Print the resulting JSON object
console.log(jsonObject);