Kyle Rainville Littleton Coin Company

Similar documents
/ Introduction to XML

Assigns a number to 110,000 letters/glyphs U+0041 is an A U+0062 is an a. U+00A9 is a copyright symbol U+0F03 is an

This tutorial will help you understand JSON and its use within various programming languages such as PHP, PERL, Python, Ruby, Java, etc.

[301] JSON. Tyler Caraza-Harter

CSC Web Technologies, Spring Web Data Exchange Formats

Introduction to JSON. Roger Lacroix MQ Technical Conference v

So, if you receive data from a server, in JSON format, you can use it like any other JavaScript object.

JSON is a light-weight alternative to XML for data-interchange JSON = JavaScript Object Notation

User Interaction: XML and JSON

Packaging Data for the Web

Grading for Assignment #1


JSON as an XML Alternative. JSON is a light-weight alternative to XML for datainterchange

Working with JavaScript

JSON - Overview JSon Terminology

AJAX. Lab. de Bases de Dados e Aplicações Web MIEIC, FEUP 2010/11. Sérgio Nunes

CSC 337. JavaScript Object Notation (JSON) Rick Mercer

Assignment #3 CSCI 201 Spring % of course grade Title Weathermeister Back-End API Integration

10/18/2017. Announcements. NoSQL Motivation. NoSQL. Serverless Architecture. What is the Problem? Database Systems CSE 414

JAVASCRIPT JQUERY AJAX FILE UPLOAD STACK OVERFLOW

Processing XML and JSON in Python

ECMA-404. The JSON Data Interchange Syntax. 2 nd Edition / December Reference number ECMA-123:2009

5/2/16. Announcements. NoSQL Motivation. The New Hipster: NoSQL. Serverless. What is the Problem? Database Systems CSE 414

REST. Web-based APIs

Database Systems CSE 414

relational Key-value Graph Object Document

Honu. Version November 6, 2010

Computer Science & Engineering 120 Learning to Code

JAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1)

Making a Clickable Map Display

Rob Weir, IBM 1 ODF and Web Mashups

Networking & The Web. HCID 520 User Interface Software & Technology

JavaScript Lecture 1

CSE 344 APRIL 16 TH SEMI-STRUCTURED DATA

Overview of the JSON Encoding Rules (JER)

JavaScript CS 4640 Programming Languages for Web Applications

Queens Library API Requirements Document For e-content Partners

Web Scraping XML/JSON. Ben McCamish

Introduction to Azure DocumentDB. Jeff Renz, BI Architect RevGen Partners

User Interaction: jquery

Lecture 8 (7.5?): Javascript

CSE 344 JULY 9 TH NOSQL

Introduction to XML. Asst. Prof. Dr. Kanda Runapongsa Saikaew Dept. of Computer Engineering Khon Kaen University

JavaScript CS 4640 Programming Languages for Web Applications

CGS 3066: Spring 2015 JavaScript Reference

Networking & The Web. HCID 520 User Interface Software & Technology

5/1/17. Announcements. NoSQL Motivation. NoSQL. Serverless Architecture. What is the Problem? Database Systems CSE 414

Introduction to XML 3/14/12. Introduction to XML

Flat triples approach to RDF graphs in JSON

2/6/2012. Rich Internet Applications. What is Ajax? Defining AJAX. Asynchronous JavaScript and XML Term coined in 2005 by Jesse James Garrett

Working with Javascript Building Responsive Library apps

Decision Making in C

Copyright Descriptor Systems, Course materials may not be reproduced in whole or in part without prior written consent of Joel Barnum

ASP.NET AJAX adds Asynchronous JavaScript and XML. ASP.NET AJAX was up until the fall of 2006 was known by the code-known of Atlas.

CS371m - Mobile Computing. Persistence - Web Based Storage CHECK OUT g/sync-adapters/index.

AJAX Workshop. Karen A. Coombs University of Houston Libraries Jason A. Clark Montana State University Libraries

Why Discuss JavaScript? CS312: Programming Languages. Lecture 21: JavaScript. JavaScript Target. What s a Scripting Language?

XML Processing & Web Services. Husni Husni.trunojoyo.ac.id

BDS Query. JSON Query Syntax

CSCE 120: Learning To Code

JAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1)

CS312: Programming Languages. Lecture 21: JavaScript

Outline. AJAX for Libraries. Jason A. Clark Head of Digital Access and Web Services Montana State University Libraries

BEFORE CLASS. If you haven t already installed the Firebug extension for Firefox, download it now from

Working with Database. Client-server sides AJAX JSON Data formats Working with JSON data Request Response Bytes Database

16. Objects & JSON. Dr. Dave Parker. Informa;on and the Web, 2014/15

INF5750. Introduction to JavaScript and Node.js

JSON & MongoDB. Introduction to Databases CompSci 316 Fall 2018

JavaScript. The Bad Parts. Patrick Behr

Class Overview. Two Classes of Database Applications. NoSQL Motivation. RDBMS Review: Client-Server. RDBMS Review: Serverless

Human-Computer Interaction Design

Chapter 2: Basic Elements of C++

Objectives. Chapter 2: Basic Elements of C++ Introduction. Objectives (cont d.) A C++ Program (cont d.) A C++ Program

Chapter 2: Basic Elements of C++ Objectives. Objectives (cont d.) A C++ Program. Introduction

Internet Engineering Task Force (IETF) Obsoletes: 4627, 7158 March 2014 Category: Standards Track ISSN:

REST in Peace Mastering the JSDO with a Dynamic ABL backend. Mike Fechner, Consultingwerk Ltd.

JavaScript: Getting Started

VistA: a first-class citizen in the JSON-centric future of Health IT

Design Document V2 ThingLink Startup

ZipRecruiter Apply Webhook Documentation. ZR ATS Integration Team. Version 1.1,

Creating and Working with JSON in Oracle Database

Create-A-Page Design Documentation

Welcome to CS50 section! This is Week 10 :(

RKN 2015 Application Layer Short Summary

JavaScript. History. Adding JavaScript to a page. CS144: Web Applications

DECOUPLING PATTERNS, SERVICES AND CREATING AN ENTERPRISE LEVEL EDITORIAL EXPERIENCE

INFS 2150 Introduction to Web Development and e-commerce Technology. Programming with JavaScript

Princess Nourah bint Abdulrahman University. Computer Sciences Department

Objectives. Introduction to JavaScript. Introduction to JavaScript INFS Peter Y. Wu, RMU 1

Announcements. Two Classes of Database Applications. Class Overview. NoSQL Motivation. RDBMS Review: Serverless

Rich Web Applications in Server-side Java without. Plug-ins or JavaScript

JavaScript. History. Adding JavaScript to a page. CS144: Web Applications

PVB CONTACT FORM 7 CALCULATOR PRO DOCUMENTATION

Tutorial 10: Programming with JavaScript

The basic format structure of the HTTP request / response messages are similar and consist of the following:

DICOM Structured Reporting: Implementation Experience

Index. Ray Nicholus 2016 R. Nicholus, Beyond jquery, DOI /

55191: Advanced SharePoint Development

Introduction Haim Michael. All Rights Reserved.

Rich Web Applications in Server-side Java without. Plug-ins or JavaScript

Transcription:

Kyle Rainville Littleton Coin Company

What is JSON? Javascript Object Notation (a subset of) Data Interchange Format Provides a way for communication between platforms & languages Derived from Javascript Key-value pairs, usually rendered in curly braces Language independent

History Discovered by Douglas Crockford (State Software) 2001 Popularized its use Named it as he considered it part of the Javascript language Later discovered that JSON was in use by Netscape as early as 1996 Needed browser-to-server communication without Java applets or Flash plugins provided the impetus Established as a standalone ECMA standard in 2013

Analogy Islands that desire to communicate

Popular uses Web service APIs make data available to third-party apps AJAX communication uses JSON to transmit data between browser-server Client-side manipulation of JSON required, usually with Javascript If server needs to perform actions with JSON, server-side programming language will need to handle it

Data Structures Essentially key-value pairs Formatted into two data structures JSON object collection of name-value pairs JSON array list of objects or values Straightforward (normally) Complexity begins values can contain numbers, Booleans, strings, nulls, and even nested arrays/objects Keys can only be strings

Example { } first_name : Sammy, last_name : Shark, location : Ocean, online : true, followers : 987

JSON Syntax Have a colon between key and value Every key-value pair separated by a comma In the previous example, the first key-value pair is first_name : Sammy. Keys left, values right Keys needs to be wrapped in double-quotes Each key must be unique per object Key strings can include whitespace, though may not be best practice (underscores preferable)

JSON Values Values are to the right of the colon Required to be one of six simple types Strings Numbers Objects Arrays Booleans Null Each type passed will maintain their syntax e.g. strings will be in quotes but numbers won t

JSON vs. XML XML has served a purpose similar to JSON s JSON requires much less formatting More readable (for humans), as a result JSON is more lightweight JSON now a common replacement for XML within AJAX requests

Validating JSON Quick check - use JSONLint.com { "key": "value", "veracity": false, "num": 6 } Is this valid JSON? { 'color': "Red", 'material': "Blood", 'worst_doctor': "Harold Shipman", } How about this?

.json files JSON can exist as an external file Generally, the format will be extended across multiple lines Not a requirement, JSON can be one line Multiple lines more readable, especially with large data sets Whitespace between elements ignored make as readable as possible

Javascript Object and JSON JSON is not the same format as a JavaScript object, despite that JSON is often considered a subset There are small differences between them Javascript s string rules are different, e.g. line-terminators not allowed Javascript object rules are also different, e.g.: Can include functions as member of object Property key can be non-quoted or single-quoted

Complex JSON JSON can become more complex than simple key-value pairs JSON can also contain nested objects and nested arrays Though these may appear to be more complex, they are still assigned as values in the key-value paradigm

Complex object nested arrays/objects -JSON object containing an array of objects -Square bracket array -Curly brace object -Though the key of contentmanagementsystems contains a nested array, it still represents a name-value pair

AJAX AJAX - Asynchronous JavaScript and XML Was part of the Web 2.0 revolution Allows for asynchronous communication between web-page/browser and server e.g. Google s Google Instant recommended searches

How AJAX Works jquery can provide abstractions to make life easier

JSON Schema Allows you to annotate and validate JSON Still in draft form (not yet adopted by IETF) Describes your existing data format clear, human- and machine-readable documentation complete structural validation, useful for automated testing validating client-submitted data http://json-schema.org/

JSON Schema Example

Demo - Album comments With ajax http://localhost/example.php Without ajax - form submission http://localhost/example-form.php

Demo - OpenWeather API http://localhost/weather2.html

Cross Origin Resource Sharing (CORS) Normally, cross-domain AJAX requests are forbidden by browsers same-origin policy How did the above work? CORS - header sent from the server There are other ways to bypass same-origin policy JSONP WebSockets

JSON as a Configuration File Becoming popular as config data Wide support, ease of parsing, and human readability Config files used often for software - allowing changes without recompiling Several popular formats - e.g. INI, XML Example use: node.js

Configuration Example Comparison

Pros & Cons to Different Config Types INI XML JSON Very human readable Not good at handling complex or nested data Less human-readable Proficient at handling complex data Human readable (not as human readable as INI) Good at handling complex data (not as many options as XML, but more options than INI)

Conclusion JSON is popular for data interchange as many systems are modeling data as objects Works great within Javascript and its popularity is a result of that Excellent at communicating with APIs As with any tool - has advantages and disadvantages Boils down to - what is the right tool for the job?

References https://www.digitalocean.com/community/tutorials/an-introduction-to-json https://www.w3schools.com/js/js_json_intro.asp http://json-schema.org/ https://www.copterlabs.com/json-what-it-is-how-it-works-how-to-use-it/ https://www.w3schools.com/js/js_json_syntax.asp https://openweathermap.org/ Bassett, Lindsay. Introduction to Javascript Object Notation: a to-the-point Guide to JSON. O'Reilly, 2015.