এজন্য replace() এবং parse() ব্যবহার করুন।
উদাহরণ
var studentDetails = `"{""name"": ""John"",""subjectName"": ""Introduction To JavaScript""}"`; console.log("The actual object="); console.log(studentDetails); var removeFirstAndLast = studentDetails.substring(1, studentDetails.length-1) var removeDoubleQuotes = removeFirstAndLast.replace(/""/gi, `"`) console.log(removeDoubleQuotes) var output = JSON.parse(removeDoubleQuotes); console.log(output); রান কমান্ড: node fileName.js। ফাইল নাম demo103.js।
আউটপুট
PS C:\Users\Amit\JavaScript-code> node demo103.js The actual object= "{""name"": ""John"",""subjectName"": ""Introduction To JavaScript""}" {"name": "John","subjectName": "Introduction To JavaScript"} { name: 'John', subjectName: 'Introduction To JavaScript' }