edit-article
Home
Up
Delete
Article Name:
Article Description:
JSON - an overview of the native JavaScript language object JSON
Chapter ID/Name:
Status:
Write
Writing
Written
Add Photo:
Owner ID:
Content:
use HTML
Edit Content
<h1 style="text-align: center;">JSON Object</h1> <h2>[WHAT]</h2> <ol> <li>[] the JSON object is used primarily to transform javascript objects into the json format used for data exchange with other applications.</li> </ol> <h2>[WHY]</h2> <ol> <li>[] to facilitate the exchange of data between different applications, machines, </li> </ol> <h2>[WHERE]</h2> <ol> <li>[] typically when javascript objects are transferred from 1 machine to another, they need to be transported in a format that travels well and json is that format.</li> </ol> <h2>[WHEN]</h2> <ol> <li>[] to convert a javascript object into a json object</li> <li>[] to convert a json object into a javascript object</li> </ol> <h2>[EXAMPLE]</h2> <ol> <li><strong>[] converting a JavaScript object into a JSON object</strong></li> </ol> <div>var myCar = {</div> <div> make: "Ford",</div> <div> model: "Mustang",</div> <div> doors: 2,</div> <div> engineSize: 5.0</div> <div>}</div> <div>var myCarJSON = JSON.stringify(myCar);</div> <ol> <li><strong>[] converting a JSON object into a javascript object</strong></li> </ol> <div>var myCar = JSON.parse(myCarJSON);</div> <h2>[HOW-TO]</h2> <ol> <li>[]</li> </ol> <h2>[REFERENCE]</h2> <ol> <li><span class="crayon-sy">[] <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON" target="_blank">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON</a><br /></span></li> </ol> <h1 style="text-align: center;"> </h1>