Javascript Object Convert to json and object convert to string

technical talkiess
0

 <!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>javascript Json Tutorial </title>

</head>

<body>

    <div class="container">This is Json Object and json stringify function with replace the objct parametr</div>

    <script>

        let jsonObject = {

            name: "Vishal usrate",

            channel: "GulGules",

            friend: "Mukesh Kale",

            food: "Chikan" 

        } 

        // console.log(jsonObject);

        let myJsonStr = JSON.stringify(jsonObject);

        // console.log(myJsonStr);


        myJsonStr = myJsonStr.replace('Chikan', 'button');

        // console.log(myJsonStr)


        newJsonObj = JSON.parse(myJsonStr);

        console.log(newJsonObj)


        



    </script>

</body>

</html>


Tags

Post a Comment

0Comments

Thanks you for commenting your questions. I will see question and respond you.

Post a Comment (0)