Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

json javascript

// Storing data:
myObj = {name: "John", age: 31, city: "New York"};
myJSON = JSON.stringify(myObj);
localStorage.setItem("testJSON", myJSON);

// Retrieving data:
text = localStorage.getItem("testJSON");
obj = JSON.parse(text);
document.getElementById("demo").innerHTML = obj.name;
Comment

JASON in javascript

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Json Tutorial</title>
</head>
<body>
    <div class="container">This is my container</div>
    <script>
        let jsonObj = {
            name: "Harry",
            channel: "CWH",
            friend: "Rohan Das",
            food: "Bhindi" //#bhindiLoverSquad
        } 
        console.log(jsonObj);
        let myJsonStr = JSON.stringify(jsonObj);
        console.log(myJsonStr);

        myJsonStr = myJsonStr.replace('Harry', 'Larry');
        console.log(myJsonStr)

        newJsonObj = JSON.parse(myJsonStr);
        console.log(newJsonObj)

        


    </script>
</body>
</html>
Comment

json javascript

var obj = {name: 'John', age: 20}

// to json
var json = JSON.stringify(obj);

//json to object
var obj1 = JSON.parse(json);
Comment

JavaScript and JSON

// JSON syntax
{
    "name": "John",
    "age": 22,
    "gender": "male",

}
Comment

JavaScript JSON

{
"employees":[
  {"firstName":"John", "lastName":"Doe"},
  {"firstName":"Anna", "lastName":"Smith"},
  {"firstName":"Peter", "lastName":"Jones"}
]
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript super 
Javascript :: javascript remove scientific notation 
Javascript :: how to include script file in javascript with javascript 
Javascript :: call multiple functions onclick react 
Javascript :: set selected value of dropdown using formcontrol in angular 
Javascript :: for in loop js 
Javascript :: js basic user class 
Javascript :: Alpinejs notification 
Javascript :: what are json files for 
Javascript :: select the items from selectors in .map reactjs 
Javascript :: jquery close 
Javascript :: This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native. 
Javascript :: react native shadow android 
Javascript :: javascript next friday 
Javascript :: How to upload an Excel sheet file using react.js and display data to a table 
Javascript :: hello world program in javascript 
Javascript :: json.stringify pretty 
Javascript :: camelcase 
Javascript :: dynamic button click in javascript 
Javascript :: js substr 
Javascript :: get file extension file upload control in javascript 
Javascript :: tableau js 
Javascript :: trigger keyboard event javascript 
Javascript :: Material-ui Accessible icon 
Javascript :: cos in javascript 
Javascript :: jquery templates 
Javascript :: javascript include a js file from another 
Javascript :: DC League of Super-Pets 
Javascript :: react native debugger 
Javascript :: get height webview from url video react native 
ADD CONTENT
Topic
Content
Source link
Name
4+9 =