How to Remove Quotes from a JSON Object in JavaScript?

Nov 14, 2022 . Admin



Hello friends,

This example is focused on how to remove quotes from a JSON object in javascript. I would like to show you remove quotes from an object in javascript. This post will give you a simple example of removing quotes from a JSON object. you'll learn how to remove quotes from a JSON object.

To remove the quotes from a JSON object you can use replace(). We have to see how to remove quotes from JSON with an example.

So, let's see bellow solution:

Example:
index.html
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>How to Remove Quotes from a JSON Object in JavaScript?</title>
</head>
<body>
<script type="text/javascript">

    //create jsonPlayer
    var jsonPlayer = "\"Rohit Sharma\"";

    //print remove quotes from an object
    console.log(jsonPlayer.replace(/\"/g, ""));  

</script>
</body>
</html>
Check The Console For Output:
Rohit Sharma

I hope it will help you...

#Javascript