How to Remove Property from a JSON Object in JavaScript?

Nov 11, 2022 . Admin

Hello friends,

This tutorial will provide an example of how to remove a single property from JSON objects in javascript. This article goes into detail on removing the property from an object in javascript. we will help you to give an example of removing the property from a JSON object in javascript.

To remove a property from a JSON object, you can use the delete operator, which is simpler and it can remove a single property at a time. Use the delete operator to remove a property from a JSON object.

So, let's see bellow solution:

<!DOCTYPE html>
    <meta charset="utf-8">
    <title>How to Remove Property from a JSON Object in JavaScript?</title>
<script type="text/javascript">

    //create jsonPlayer
    let jsonPlayer = {
        firstName: "Virat",
        lastName: "Kohli",
        gender: "Male",
        team: "India",
        age: 35

    //use delete for remove property named age
    delete jsonPlayer.age;

    const json = JSON.stringify(jsonPlayer);

    //print removed object property

Check The Console For Output:

I hope it will help you...