JSON Valery Ivanov.

Slides:



Advertisements
Similar presentations
JavaScript I. JavaScript is an object oriented programming language used to add interactivity to web pages. Different from Java, even though bears some.
Advertisements

Web Service Testing RESTful Web Services Snejina Lazarova Dimo Mitev
Copyright © Steven W. Johnson
What are Web Services? How to use them?
SE 480: Client Side Scripting Languages Week 10: Ajax Data Sources Copyright © Steven W. Johnson October 1, 2014.
JavaScript Object Notation
With jQuery and AJAX Doncho Minkov Telerik Corporation Technical Trainer.
JSON IDU0075 Sissejuhatus veebiteenustesse.  JSON stands for JavaScript Object Notation  JSON is lightweight text-data interchange format  JSON is.
Working with JavaScript. 2 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page Working with Variables.
15-Jul-15 JSON. JSON example “JSON” stands for “JavaScript Object Notation” Despite the name, JSON is a (mostly) language-independent way of specifying.
More APIs: Web Services CMPT 281. Announcements Project milestone Lab: – Web services examples.
JSON (JavaScript Object Notation).  A lightweight data-interchange format  A subset of the object literal notation of JavaScript (or ECMA-262).  A.
1 WebSocket & JSON Java APIs Hackday By Somay David
CGI and AJAX CS-260 Dick Steflik.
PHP H ypertext P re-processor. Unit 6 - PHP - Hello World! - Data types - Control structures - Operators.
AIT 616 Fall 2002 PHP. AIT 616 Fall 2002 PHP  Special scripting language used to dynamically generate web documents  Open source – Free!!!  Performs.
Avro Apache Course: Distributed class Student ID: AM Name: Azzaya Galbazar
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
The New Zealand Institute for Plant & Food Research Limited Matthew Laurenson Web Services: Introduction & Design Considerations.
RESTful applications Norman White. REST Representational state transfer Key concepts – Client Server architecture built on transferring resources between.
Lecture 13 – XML and JSON SFDV3011 – Advanced Web Development Reference: 1.
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
HTML5. HTML5’s overall theme The browser as a rich application platform rich, cross-device user interfaces offline operation capability hardware access.
XP Tutorial 10New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with JavaScript Creating a Programmable Web Page for North Pole.
Javascript II DOM & JSON. In an effort to create increasingly interactive experiences on the web, programmers wanted access to the functionality of browsers.
JSON-LD. JSON as an XML Alternative JSON is a light-weight alternative to XML for data- interchange JSON = JavaScript Object Notation – It’s really language.
Serialization. Serialization is the process of converting an object into an intermediate format that can be stored (e.g. in a file or transmitted across.
ICOM 4035 – Data Structures Lecture 11 – Map ADT Manuel Rodriguez Martinez Electrical and Computer Engineering University of Puerto Rico, Mayagüez ©Manuel.
JSON Java Script Object Notation Copyright © 2013 Curt Hill.
XP Tutorial 10New Perspectives on HTML and XHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial.
JSON and A Comparison of Scripts. JSON: JavaScript Object Notation Based on a subset of the JavaScript Programming Language provides a standardized data.
Google Data Protocol Guy Mark Lifshitz. Motivation Google’s Mission: – Organize the world’s information – Make information universally accessible – Provide.
Introduction to Web Services
Web Technologies Lecture 4 XML and XHTML. XML Extensible Markup Language Set of rules for encoding a document in a format readable – By humans, and –
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.
General Computer Science for Engineers CISC 106 Lecture 12 James Atlas Computer and Information Sciences 08/03/2009.
AJAX. Ajax  $.get  $.post  $.getJSON  $.ajax  json and xml  Looping over data results, success and error callbacks.
Introduction to JavaScript CSc 2320 Fall 2014 Disclaimer: All words, pictures are adopted from “Simple JavaScript”by Kevin Yank and Cameron Adams and also.
Jennifer Widom JSON Data Introduction. Jennifer Widom JSON Introduction JavaScript Object Notation (JSON)  Standard for “serializing” data objects, usually.
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.
Dr. Abdullah Almutairi Spring PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used,
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.
Tools of the trade J SON, M AVEN, A PACHE COMMON Photo from
JSON (Copied from and from Prof Da Silva) Week 12 Web site:
XP Tutorial 10New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties.
XML Notes taken from w3schools. What is XML? XML stands for EXtensible Markup Language. XML was designed to store and transport data. XML was designed.
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.
Embt.co/sprint-rest-json-services Blog Notes: Building RESTful servers. In C++ Builder Developer Skill Sprint Tips, Tricks and Techniques The Ultimate.
Introduction to Mongo DB(NO SQL data Base)
The Fat-Free Alternative to XML
Storing Data.
The Fat-Free Alternative to XML
JSON.
Exporting and Importing Data
JSON Crash Course Traversy Media.
JSON-LD.
Exporting and Importing Data
Built in Fairfield County: Front End Developers Meetup
JSON.
HTML5 AJAX & JSON APIs
2017, Fall Pusan National University Ki-Joune Li
JSON Data Demo.
Strings and Serialization
Integrating REST API and SQL Server JSON Functions
Department of Computer Science Cal State East Bay, Hayward, CA
CS 240 – Advanced Programming Concepts
The Fat-Free Alternative to XML
JSON: JavaScript Object Notation
JSON-LD.
Presentation transcript:

JSON Valery Ivanov

JavaScript Object Notation What is JSON? JSON is lightweight text-data interchange format JSON is language independent* JSON is "self-describing" and easy to understand *JSON uses JavaScript syntax for describing data objects, but JSON is still language and platform independent. JSON parsers and JSON libraries exists for many different programming languages. JSON - Evaluates to JavaScript Objects The JSON text format is syntactically identical to the code for creating JavaScript objects. Because of this similarity, instead of using a parser, a JavaScript program can use the built-in eval() function and execute JSON data to produce native JavaScript objects.

When to use JSON? SOAP is a protocol specification for exchanging structured information in the implementation of Web Services. SOAP internally uses XML to send data back and forth. REST is a design concept. You are not limited to picking XML to represent data, you could pick anything really (JSON included).

JSON example { "firstName": "John", "lastName": "Smith", "age": 25, "address": { "streetAddress": "21 2nd Street", "city": "New York", "state": "NY", "postalCode": 10021 }, "phoneNumbers": [ "type": "home", "number": "212 555-1234" "type": "fax", "number": "646 555-4567" } ]

JSON to XML <?xml version="1.0" encoding="UTF-8"?> <persons> <person> <firstName>John</firstName> <lastName>Smith</lastName> <age>25</age> <address> <streetAddress>21 2nd Street</streetAddress> <city>New York</city> <state>NY</state> <postalCode>10021</postalCode> </address> <phoneNumbers> <phoneNumber> <number>212 555-1234</number> <type>home</type> </phoneNumber> <number>646 555-4567</number> <type>fax</type> </phoneNumbers> </person> </persons>

JSON vs XML size XML: 549 characters, 549 bytes JSON: 326 characters, 326 bytes XML ~68,4 % larger than JSON! But large data set is going to be large regardless of the data format you use. Most servers gzip or otherwise compress content before sending it out, the difference between gzipped JSON and gzipped XML isn’t nearly as drastic as the difference between standard JSON and XML.

JSON Values JSON values can be: A number (integer or floating point) A string (in double quotes) A boolean (true or false) An array (in square brackets) An object (in curly brackets) null

Why JSON? For AJAX applications, JSON is faster and easier than XML: Using XML Fetch an XML document Use the XML DOM to loop through the document Extract values and store in variables Using JSON Fetch a JSON string eval() the JSON string

Security problems The eval() function can compile and execute any JavaScript. This represents a potential security problem. It is safer to use a JSON parser to convert a JSON text to a JavaScript object. A JSON parser will recognize only JSON text and will not compile scripts. In browsers that provide native JSON support, JSON parsers are also faster. Native JSON support is included in newer browsers and in the newest ECMAScript (JavaScript) standard.

JSON vs XML Favor XML over JSON when any of these is true: You need message validation You're using XSLT Your messages include a lot of marked-up text You need to interoperate with environments that don't support JSON Favor JSON over XML when all of these are true: Messages don't need to be validated, or validating their deserialization is simple You're not transforming messages, or transforming their deserialization is simple Your messages are mostly data, not marked-up text The messaging endpoints have good JSON tools

JSON Schema Describes your JSON data format http://jsonschemalint.com/ http://json-schema.org/implementations http://en.wikipedia.org/wiki/JSON#Schema_and_Metadata

JSON vs XML "Some people, when confronted with a problem, think "I know, I'll use XML." Now they have two problems. " "XML is like violence. If it doesn't solve your problem, you're not using enough of it. " "I use JSON unless I'm required to use XML. " " I don't hate XML and I don't find it frustrating. I sure as hell hate people that try to solve every problem in the world with XML. "

Sources http://en.wikipedia.org/wiki/JSON http://www.w3schools.com/json/ http://www.json.org/ http://json-schema.org http://www.nczonline.net/blog/2008/01/09/is-json-better-than-xml/ http://en.wikipedia.org/wiki/SOAP_(protocol) http://en.wikipedia.org/wiki/REST http://stackoverflow.com/questions/16626021/json-rest-soap-wsdl-and-soa-how-do-they-all-link-together

Questions?