json

15
Prepared for Dr. Azrul Hazri bin Jantan Present by Zainal Abdul Kahar JSON Discovering JavaScript Object Notation Review Computing Conversations By Charles Severance University of Michigan

Upload: zainal-abdul-kahar

Post on 28-Jun-2015

74 views

Category:

Education


1 download

TRANSCRIPT

Page 1: Json

Prepared for Dr. Azrul Hazri bin Jantan Present by Zainal Abdul Kahar

JSON Discovering JavaScript Object Notation

Review!Computing Conversations!By Charles Severance!University of Michigan

Page 2: Json

Background❖ Discovered by Douglas Crockford self-

appointed evangelist!

❖ Invent and applying JSON in 2001 at State Software!

❖ Create a webpage to make it as standard!

❖ Popular format for data serialisation!

❖ Extensively use to encode data for transfer between server and Ajax application, to connect two servers communicating via web services

Page 3: Json

Introduction

❖ JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write and easy for machines to parse and generate!

❖ It is based on a subset of the JavaScript Programming Language!

❖ JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others

Page 4: Json

Data exchange❖ The most common structures use in programming are scalar variables, linear

lists and key-value pair!

❖ JSON represents these structures in a form of direct serialisation!

❖ Greatly reduce the mismatch between in memory structure in application and the serialisation format!

❖ JSON is convenient and efficient!

❖ Using JSON in JavaScript gives advantage compared of using other format such as XML

Page 5: Json

JSON vs XML

❖ It is a constant debate between JSON and XML for the right formatting for data representation!

❖ XML is an enterprise solution with many toolset for manipulation!

❖ JSON slowly displacing XML as the preferred way for data exchange!

❖ JSON has the natural advantage as a serialisation format which exactly the same as data structures that programming language represent

Page 6: Json

JSON vs XML❖ The number of new API using JSON is increasing and displacing XML

Page 7: Json

XML vs JSON

Page 8: Json

JSON Structure

❖ JSON is built on two structures:!

❖ A collection of name/value pairs. In various languages, this is realised as an object, record, struct, dictionary, hash table, keyed list, or associative array.!

❖ An ordered list of values. In most languages, this is realised as an array, vector, list, or sequence.

Page 9: Json

JSON Structure

Source JSON.ORG

Page 10: Json

JSON Structure

Page 11: Json
Page 12: Json

TEST CODE

Page 13: Json

Raw Data

Data extracted from VB.net Server

Page 14: Json

Security

❖ Although JSON is intended solely as a data serialisation format, its design as a non-strict subset of the JavaScript scripting language poses several security concerns. These concerns centre on the use of a JavaScript interpreter to execute JSON text dynamically as embedded JavaScript. This exposes a program to errant or malicious scripts. This is a serious issue when dealing with data retrieved from the Internet.

Page 15: Json

Future of JSON

❖ According to Charles, once the programmer switch to JSON, they seldom get back to XML!

❖ The more programmers use JSON, the requirement for schema for JSON’s object grows!

❖ There are effort to add value to JSON without changing it such as “JSON for linked data”.