1 / 11

JSON and A Comparison of Scripts

JSON and A Comparison of Scripts. JSON: JavaScript Object Notation. Based on a subset of the JavaScript Programming Language provides a standardized data exchange format that is better-suited for Ajax-style web applications.

shayla
Download Presentation

JSON and A Comparison of Scripts

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. JSONandA Comparison of Scripts

  2. JSON: JavaScript Object Notation • Based on a subset of the JavaScript Programming Language • provides a standardized data exchange format that is better-suited for Ajax-style web applications. formal languages specifically designed to support the communication of data and metadata.

  3. JSON: JavaScript Object Notation • Language independant, but similar to C-family (C, Java, Perl, Python) • Data formatted according to the JSON standard is lightweight and can be parsed by JavaScript implementations with incredible ease

  4. JSON: JavaScript Object Notation • Built on two structures: • Name/value pair • Ordered list of values

  5. JSON literals

  6. JSON: the difference • JSON: much stricter rules. • name of an object member must be a valid JSON string. • string must be enclosed in quotation marks. • array and object elements are limited to a set. • No date/time literal (not in JavaScript either) • No comments

  7. Using JSON • Use a script tag <script src="http://www.mysite.com/mydata.js"></script> • Dynamically load a script tag function dhtmlLoadScript(url) { var e = document.createElement("script"); e.src = url; e.type="text/javascript"; document.getElementsByTagName("head")[0].appendChild(e); } dhtmlLoadScript("http://www.mysite.com/mydata.js");

  8. Using JSON • Use AJAX to pull some text from the server and then eval it. ajaxCaller.getPlainText("mydata.js", function(jsText) { eval(jsText); });

  9. Server vs Client Side Scripting

  10. Client-side Scripting • Easy way to provide additional functionality and flexibility • Downloaded, interpreted and executed by the browser • Dependant on the client's capabilities (memory, CPU speed, video card) • Lightweight, less full-featured language • Examples: JavaScript, JScript, VBScript

  11. Server-side Scripting • Also enhances functionality, but usually less visible • Used for content management (database) • Runs on the server and depends on memory and CPU speed of the server • Must be supported by the server • Examples: PHP, ASP, Perl

More Related