The Fat-Free Alternative to XML

Slides:



Advertisements
Similar presentations
Copyright © Steven W. Johnson
Advertisements

What are Web Services? How to use them?
An Introductory Tutorial. Background and Purpose.
JSON Valery Ivanov.
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.
More APIs: Web Services CMPT 281. Announcements Project milestone Lab: – Web services examples.
Semantic Web Andrejs Lesovskis. Publishing on the Web Making information available without knowing the eventual use; reuse, collaboration; reproduction.
JSON The Fat Free Alternative to XML. Data Interchange The key idea in Ajax. An alternative to page replacement. Applications delivered as pages. How.
Practical RDF Chapter 1. RDF: An Introduction
The New Zealand Institute for Plant & Food Research Limited Matthew Laurenson Web Services: Introduction & Design Considerations.
Lecture 13 – XML and JSON SFDV3011 – Advanced Web Development Reference: 1.
WEB API: WHY THEY MATTER ECOL 453/ Nirav Merchant
HTML5. HTML5’s overall theme The browser as a rich application platform rich, cross-device user interfaces offline operation capability hardware access.
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.
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.
XML Steve Fisher/RAL. 20 October 2000XML - Steve Fisher/RAL2 Warning Information may not be all completely up to date.
Google Data Protocol Guy Mark Lifshitz. Motivation Google’s Mission: – Organize the world’s information – Make information universally accessible – Provide.
Introduction to Web Services
AJAX. Ajax  $.get  $.post  $.getJSON  $.ajax  json and xml  Looping over data results, success and error callbacks.
Google maps engine and language presentation Ibrahim Motala.
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:
Embt.co/sprint-rest-json-services Blog Notes: Building RESTful servers. In C++ Builder Developer Skill Sprint Tips, Tricks and Techniques The Ultimate.
XSEDE GLUE2 Update 1. Current XSEDE Usage Using legacy TeraGrid information services Publishing compute information about clusters – Subset of XSEDE clusters.
WELCOME MIDHUN SUDHAKAR twitter.com/midhunopus in.linkedin.com/pub/midhunsudhakar/86/a65/a9.
Introduction to Mongo DB(NO SQL data Base)
Information Retrieval in Practice
Framework and Graph Visualization Tools
Storing Data.
JSON and JSON-Schema for XML Developers
Using JMP® Visualization for A Bike-Sharing Program in NYC
Parsing JSON JSON.NET, LINQ-to-JSON
Stanford University, Stanford, CA, USA
The Fat-Free Alternative to XML
JSON.
Exporting and Importing Data
JSON Crash Course Traversy Media.
DSRA -Relative Web technology clarification in Technology Architecture
JSON-LD.
Exporting and Importing Data
Database Systems Week 12 by Zohaib Jan.
Consuming Java Script Object Notation (JSON) feeds
CSV Classic format Comma Separated Variables (CSV). Easily parsed.
NOSQL databases and Big Data Storage Systems
New Mexico State University
Session V HTML5 APIs - AJAX & JSON
Built in Fairfield County: Front End Developers Meetup
Intro to NoSQL Databases
Intro to NoSQL Databases
HTML Level II (CyberAdvantage)
A JSON’s Journey through SQL Server
HTML5 AJAX & JSON APIs
2017, Fall Pusan National University Ki-Joune Li
Python Jumpstart.
JSON Data Demo.
Intro to NoSQL Databases
Strings and Serialization
Integrating REST API and SQL Server JSON Functions
Lecture 9: XML Monday, October 17, 2005.
relational thoughts on NoSql
JSON for Linked Data: a standard for serializing RDF using JSON
The Fat-Free Alternative to XML
Both XML ad JSON are designed to transport data
MIS2502: Data Analytics Semi-structured Data Analytics
JSON: JavaScript Object Notation
JSON-LD.
Intro to NoSQL Databases
Presentation transcript:

The Fat-Free Alternative to XML

JSON as an XML Alternative JSON is a light-weight alternative to XML for data-interchange JSON = JavaScript Object Notation It’s really language independent Most programming languages can easily read it and instantiate objects or some other data structure Defined in RFC 4627, IETF, July 2006 http://json.org/ has more information

JSON TL;DR Lightweight data-interchange format Easy for humans to read and write Easy for machines to parse and generate Not tied tied to Javascript or Web

Example This is a JSON object with five key-value pairs {"firstName": "John", "lastName" : "Smith", "age" : 25, "address" : {"streetAdr” : "21 2nd Street", "city" : "New York", "state" : "NY", ”zip" : "10021"}, "phoneNumber": [ {"type" : "home", "number": "212-555-1234"}, {"type" : "fax", "number” : "646-555-4567"} ] } This is a JSON object with five key-value pairs Objects are wrapped by curly braces There are no object IDs Keys are strings Values are numbers, strings, objects or arrays Arrays/lists are wrapped by square brackets

Simple BNF

Evaluation JSON is simpler and more compact than XML No closing tags, but if you compress XML and JSON the difference is not so great XML parsing is hard because of its complexity JSON has a better fit for OO systems than XML JSON is not as extensible as XML Preferred for simple data exchange by many Less syntax, no semantics Schemas? We don’t need no stinkin schemas! Transforms? Write your own

JSON-LD JSON-LD is a W3C recommendation for representing RDF data as JSON objects {"@context": { "name": "http://xmlns.com/foaf/0.1/name", "homepage": { "@id": "http://xmlns.com/foaf/0.1/workplaceHomepage", "@type": "@id" }, "Person": "http://xmlns.com/foaf/0.1/Person" "@id": "http://me.markus-lanthaler.com", "@type": "Person", "name": "Markus Lanthaler", "homepage": "http://www.tugraz.at/" }

Many popular systems use JSON MongoDB is an open-source database for JSON objects Very popular NoSQL database A NoSQL DB is one that uses a model not based on relational tables Elastic Search is a popular, scalable information retrieval engine that uses JSON as its native representation

Example: JSON in Python >>> import json >>> x = json.load(open('example.json')) >>> x {u'lastName': u'Smith', u'age': 25, u'phoneNumber': [{u'type': u'home', u'number': u'212-555-1234'}, {u'type': u'fax', u'number': u'646-555-4567'}], u'firstName': u'John', u'address': {u'streetAdr': u'21 2nd Street', u'state': u'NY', u'zip': u'10021', u'city': u'New York'}} >>> x['address']['state'] u'NY' >>> print json.dumps(x, sort_keys=True, separators=(',',':'), indent=2) {"address":{ "city":"New York", "state":"NY", "streetAdr":"21 2nd Street", "zip":"10021”}, "age":25, "firstName":"John", "lastName":"Smith", "phoneNumber":[ { "number":"212-555-1234", "type":"home”}, {"number":"646-555-4567", "type":"fax” } ] } >>> Python’s JSON package reads and writes json from/to files and strings Maps JSON objects to Python dictionaries Maps JSON arrays to python lists Dump (write to file) and dumps (write to string) functions can do simple pretty printing

JSON vs. XML JSON: The Fat-Free Alternative to XML json.org page laying out the case for JSON over XML Stop Comparing JSON and XML Blog post arguing that they're very different things with their own areas of applicability XML JSON There are many web tools and software packages that can convert between simple xml and json representations, e.g.: this one

Worse is Better? JSON vs. XML can be viewed as an example of “Worse is Better” In 1989 Dick Gabriel headed a company that had the best commercial version of Lisp Lisp was considered by programming language experts to be superior to the much more popular C Cf. today: Scheme vs. Python (w.r.t. mutable lists) Gabriel explained it as worse is better software that's limited, but simple to learn/use, and flexible, can be more popular to most users