JSON – Java Script Object Notation. What is JSON JSON is a data interchange format Interactive Web 2.0 applications, no more use page replacement. Data.

Slides:



Advertisements
Similar presentations
PHP I.
Advertisements

Copyright © Steven W. Johnson
AJAX Presented by: Dickson Fu Dimas Ariawan Niels Andreassen Ryan Dial Jordan Nielson CMPUT 410 University of Alberta 2006.
WHAT IS AJAX? Zack Sheppard [zts2101] WHIM April 19, 2011.
15-Jul-15 JSON. JSON example “JSON” stands for “JavaScript Object Notation” Despite the name, JSON is a (mostly) language-independent way of specifying.
Web Programming Language Dr. Ken Cosh Week 1 (Introduction)
Chapter 6 DOJO TOOLKITS. Objectives Discuss XML DOM Discuss JSON Discuss Ajax Response in XML, HTML, JSON, and Other Data Type.
JSON (JavaScript Object Notation).  A lightweight data-interchange format  A subset of the object literal notation of JavaScript (or ECMA-262).  A.
CSCI 6962: Server-side Design and Programming Course Introduction and Overview.
Languages in WEB Presented by: Jenisha Kshatriya BCM SS09.
Lecture 12 – AJAX SFDV3011 – Advanced Web Development Reference: 1.
GIS technologies and Web Mapping Services
JSON The Fat Free Alternative to XML. Data Interchange The key idea in Ajax. An alternative to page replacement. Applications delivered as pages. How.
ASP.NET + Ajax Jesper Tørresø ITNET2 F08. Ajax Ajax (Asynchronous JavaScript and XML) A group of interrelated web development techniques used for creating.
Lecture 13 – XML and JSON SFDV3011 – Advanced Web Development Reference: 1.
XML Extensible Markup Language. What is XML? An infrastructure for describing text and data Developed by W3C(the World Wide Web Consortium)
IST 210: PHP BASICS IST 210: Organization of Data IST210 1.
CSCI 6962: Server-side Design and Programming Web Services.
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
Instructor, Dr. Khalili Bahram Jeevan Kumar Gogineni.
The Document Object Model. The Web B.D, A.D. They aren’t web pages, they’re document objects A web browser interprets structured information. A server.
Chapter 8 Cookies And Security JavaScript, Third Edition.
Building Rich Web Applications with Ajax Linda Dailey Paulson IEEE – Computer, October 05 (Vol.38, No.10) Presented by Jingming Zhang.
Lecture 9: AJAX, Javascript review..  AJAX  Synchronous vs. asynchronous browsing.  Refreshing only “part of a page” from a URL.  Frameworks: Prototype,
1 MSCS 237 Overview of web technologies (A specific type of distributed systems)
JSON and A Comparison of Scripts. JSON: JavaScript Object Notation Based on a subset of the JavaScript Programming Language provides a standardized data.
Ajax. –Asynchronous JavaScript and XML –Umbrella term for technologies that often: Use client-side scripting for layout and formatting Use less than full.
Asynchronous Javascript And XML AJAX : an introduction UFCEUS-20-2 : Web Programming.
XML Alyssa Roberts. What is XML? Extensible Markup Language Specification to creating custom mark-up languages Simplified version of SGML, originally.
Web Application with AJAX CS 526 advanced interned and Web system Presenters Faris Kateb Mohammed AbdulAziz Omar Alzahrani.
Ajax for Dynamic Web Development Gregory McChesney.
INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.
 AJAX – Asynchronous JavaScript and XML  Ajax is used to develop fast dynamic web applications  Allows web pages to be updated asynchronously by transferring.
ICM – API Server & Forms Gary Ratcliffe.
 Web pages originally static  Page is delivered exactly as stored on server  Same information displayed for all users, from all contexts  Dynamic.
AJAX. Ajax  $.get  $.post  $.getJSON  $.ajax  json and xml  Looping over data results, success and error callbacks.
CHAPTER 8 AJAX & JSON WHAT IS AJAX? Ajax lets you…
AJAX and REST. Slide 2 What is AJAX? It’s an acronym for Asynchronous JavaScript and XML Although requests need not be asynchronous It’s not really a.
Dave Salinas. What is XML? XML stands for eXtensible Markup Language Markup language, like HTML HTML was designed to display data, whereas XML was designed.
OVERVIEW AND PARSING JSON. What is JSON JavaScript Object Notation Used to format data Commonly used in Web as a vehicle to describe data being sent between.
AJAX – Asynchronous JavaScript And XML By Kranthi Kiran Nuthi CIS 764 Kansas State University.
Web Technology (NCS-504) Prepared By Mr. Abhishek Kesharwani Assistant Professor,UCER Naini,Allahabad.
JSON. JSON as an XML Alternative JSON is a light-weight alternative to XML for data- interchange JSON = JavaScript Object Notation It’s really language.
JSON (Copied from and from Prof Da Silva) Week 12 Web site:
JavaScript and Ajax Week 10 Web site:
JSON JavaScript Object Notation Douglas Crockford Yahoo! Inc.
Web Services Essentials. What is a web service? web service: software functionality that can be invoked through the internet using common protocols like.
IST 210: PHP Basics IST 210: Organization of Data IST2101.
XML & JSON. Background XML and JSON are to standard, textual data formats for representing arbitrary data – XML stands for “eXtensible Markup Language”
JQuery, JSON, AJAX. AJAX: Async JavaScript & XML In traditional Web coding, to get information from a database or a file on the server –make an HTML form.
Ajax & Client-side Dynamic Web Gunwoo Park (Undergraduate)
1 ODF and Web Mashups Basic techniques Rob Weir, IBM :15.
National College of Science & Information Technology.
World Wide Web policy.
AJAX and REST.
DSRA -Relative Web technology clarification in Technology Architecture
Ajax Design Patterns – Programming Practices in Web Services
Built in Fairfield County: Front End Developers Meetup
JavaScript & jQuery AJAX.
MIS JavaScript and API Workshop (Part 3)
Department of Computer Science Cal State East Bay, Hayward, CA
CS 240 – Advanced Programming Concepts
Tutorial 10: Programming with javascript
Ajax and JSON Jeremy Shafer Department of MIS Fox School of Business
Class 4: Building Interactive Web Pages
Ajax and JSON Jeremy Shafer Department of MIS Fox School of Business
PHP and JSON Topics Review JSON.
Web Application Development Using PHP
Presentation transcript:

JSON – Java Script Object Notation

What is JSON JSON is a data interchange format Interactive Web 2.0 applications, no more use page replacement. Data transfer without refreshing a page. The most important aspects of data transfer are simplicity, extensibility, interoperability, openness and human readability Key idea in AJAX – Asynchronous Java Script and XML.

Topics to cover Overview of the working of JSON Properties of JSON as a data format JSON with AJAX Advantages of using JSON with AJAX Security Concerns in using JSON Where does it fit the best

How does it work? JSON is a subset of Java Script. JSON can be parsed by a Java Script parser. It can represent either complex or simple data as it has data types They are Strings, Number, Boolean, Objects and Arrays E.g. of Object: { "name": "Jack (\"Bee\") Nimble", "format": { "type": "rect", "width": 120, "interlace": false}}

An array can be shown as ["Sunday", "Monday", "Tuesday", "Wednesday“] All data types are intuitive and similar to other programming languages Also compatible with other languages like C, C++, C#, ColdFusion, Python and many more.

Properties of JSON It's simultaneously human- and machine-readable format. It has support for Unicode, allowing almost any information in any human language to be communicated; The self-documenting format that describes structure and field names as well as specific values. The strict syntax and parsing requirements that allow the necessary parsing algorithms to remain simple, efficient, and consistent; The ability to represent the most general computer science data structures: records, lists and trees.

JSON in AJAX JSON can be used in AJAX as follows: Include it in HTML directly... var data = JSONdata;... JSON is used with XMLHttpRequest and can be converted into a JavaScript structure responseData = eval('(' + responseText + ')');

Another approach is to use an invisible for data communication. The server sends JSON text embedded in a script in a document. document.domain = ‘something.com’; parent.deliver(JSONtext); deliver is passed the incoming data structure.

Why is JSON better suited for AJAX? JSON is widely used in AJAX. The X in AJAX stands for XML. E.g. { "fullname": "Swati Kumar", "org": "Columbia", } Swati Kumar Columbia

JSON response at client side is: var name = eval('(' + req.responseText + ')').fullname.value; To access a composite element eval('(' + req.responseText + ')').xyz.abc.value; Thus, any level deep elements can be easily accessed.

XML response at client side is: var root = req.responseXML; var name = root.getElementsByTagName(‘fullname’); To access a composite element root.getElementsByTagName(‘xyz’)[0].firstChi ld To access deeper levels we need more overhead. Reduced extensibility in XML

Security Concerns Same Origin Policy - JavaScript to access the contents of a Webpage, both the JavaScript and the Web page must originate from the same domain. Malicious website could serve up JavaScript that loads sensitive information from other websites using a client's credentials and communicates it back to the attacker.

Although the malicious JavaScript can’t directly manipulate the contents, it can view the execution of the JavaScript and store the results it returns. This problem gets aggravated with JSON as the JSON arrays are themselves JavaScript objects and any malicious user can view them directly.

Where can JSON be used? JSON is a light weight data format that can be used for transferring medium amounts of data. It can be used in Java Script and then rendered on HTML pages AJAX has many applications for JSON Thus, use JSON for applications that are browser based.

References: RFC 4627, Network Working Group D. Crockford Thank you