SlideShare a Scribd company logo
Introduction to JSON
Dr. Kanda Runapongsa Saikaew
Department of Computer Engineering
Khon Kaen University
http://gear.kku.ac.th/~krunapon/xmlws
1
1
Agenda
• 
• 
• 
• 
• 
• 

What is JSON?
JSON vs. XML
JSON Tutorial
JSON and AJAX
Using JSON with Google Data Protocol
PHP and JSON
•  Encoding
•  Decoding
What is JSON?
•  JSON (JavaScript Object Notation) is a lightweight
data-interchange format. It is easy for humans to
read and write
•  It is easy for machines to parse and generate.
•  JSON is a text format that is completely language
independent
•  JSON is built on two structures:
A collection of name/value pairs. In various languages, this
is realized as an object, record, struct, dictionary, hash
table, keyed list, or associative array.
o  An ordered list of values. In most languages, this is
realized as an array, vector, list, or sequence.
o 
JSON Forms: An object
•  An object is an unordered set of name/value pairs
•  An object begins with { (left brace) and ends
with } (right brace)
•  Each name is followed by: (colon) and the name/
value pairs are separated by , (comma)
JSON Forms: An Array
•  An array is an ordered collection of values
•  An array begins with [ (left bracket) and ends with ] (right
bracket)
•  Values are separated by , (comma).
JSON Forms: A Value
•  A value can be a string in double quotes, or a number,
or true or false or null, or an object or an array
•  These structures can be nested.
JSON Forms: A String
•  A string is a sequence of zero or more Unicode characters, wrapped
in double quotes, using backslash escapes
•  A character is represented as a single character string
•  A string is very much like a C or Java string
JSON Forms: A Number
•  A number is very much like a C or Java number, except that the
octal and hexadecimal formats are not used
JSONView Chrome Extension
h"ps://chrome.google.com/webstore/detail/jsonview/
chklaanhfe:npoihckbne;akgolnmc?hl=en	
  
	
  

9
JSON Sample
Squiggles, Squares, Colons, and Commas
1. Squiggly brackets act as 'containers'
o  {...}
• 2. Square brackets holds arrays
o  [...]
• 3. Names and values are separated by a colon
o  name:value
• 4. Array elements are separated by commas
o  [member1, member2]
JSON is like XML because
1. They are both 'self-describing' meaning that values
are named, and thus 'human readable'
2. Both are hierarchical. (i.e. You can have values
within values.)
3. Both can be parsed and used by lots of programming
languages
4. Both can be passed around using AJAX (i.e.
httpWebRequest)
JSON is Unlike XML because
1. XML uses angle brackets, with a tag name at the start
and end of an element: JSON uses squiggly brackets
with the name only at the beginning of the element.
2. JSON is less verbose so it's definitely quicker for humans
to write, and probably quicker for us to read.
3. JSON can be parsed trivially using the eval() procedure
in JavaScript
4. JSON includes arrays {where each element doesn't have
a name of its own}
5. In XML you can use any name you want for an element,
in JSON you can't use reserved words from javascript
JSON in JavaScript
•  JSON is a subset of the object literal notation of JavaScript.
Since JSON is a subset of JavaScript, it can be used in the
language with no muss or fuss.
•  var myJSONObject =
{"bindings":
[ {"ircEvent": "PRIVMSG", "method": "newURI", "regex":
"^http://.*"}, {"ircEvent": "PRIVMSG", "method": "deleteURI",
"regex": "^delete.*"}, {"ircEvent": "PRIVMSG", "method":
"randomURI", "regex": "^random.*"} ] };
•  In this example, an object is created containing a single
member "bindings", which contains an array containing three
objects, each containing "ircEvent", "method",
and"regex" members.
Accessing JSON in JavaScript

• var	
  myJSONObject	
  =	
  	
  
{"bindings":	
  [	
  {"ircEvent":	
  "PRIVMSG",	
  	
  
"method":	
  "newURI",	
  "regex":	
  "^h"p://.*"},...]}	
  
•  Members	
  can	
  be	
  retrieved	
  using	
  dot	
  or	
  subscript	
  	
  
operators.	
  
	
  	
  	
  myJSONObject.bindings[0].method	
  	
  	
  
//	
  "newURI"	
  
•  To	
  convert	
  a	
  JSON	
  text	
  into	
  an	
  object,	
  you	
  can	
  use	
  the	
  	
  
eval()func[on.	
  eval()	
  invokes	
  the	
  JavaScript	
  compiler	
  
•  The	
  text	
  must	
  be	
  wrapped	
  in	
  parenthese	
  to	
  avoid	
  tripping
on	
  an	
  ambiguity	
  in	
  JavaScript's	
  syntax.	
  
var	
  myObject	
  =	
  eval('('	
  +	
  myJSONtext	
  +	
  ')');	
  
Objects as Data
<html>
<body>
<script type="text/javascript">
var myFirstJSON = {"firstName" : "Tata",
"lastName" : "Saikaew",
"age" : 3};
document.writeln(myFirstJSON.firstName);
document.writeln(myFirstJSON.lastName);
document.writeln(myFirstJSON.age);
</script>
</body>
</html>
Nested Objects
<html>
<body>
<script type="text/javascript">
var employees = { "accountings" : [ // accounting is an array in
employees
{"firstName" : "Tata", "lastName" : "Saikaew", "age" : 30},
{"firstName" : "Teetee", "lastName" : "Wongkaew", "age" : 26} ],
"sales" : [ // Sales is another array in employees
{ "firstName" : "Manee", "lastName" : "Jaidee", "age" : 28},
{ "firstName" : "Mana", "lastName" : "Deejai", "age" : 32}]
}; // End employees
document.write(employees.accountings[0].firstName);
</script>
</body>
</html>
Simulating An Associated Array
<html>
<body>
<script type="text/javascript">
var myObject = {'color' : 'blue',
'animal' : {'dog' : 'friendly' }
};
document.writeln(myObject.animal.dog);
document.writeln(myObject['color']);
document.writeln(myObject['animal']['dog']);
</script>
</body>
</html>
XML File
<wclass>
<!--My students who took web programming class with me-->
<student id="1">
<name>Linda Jones</name>
<legacySkill>Access, VB5.0</legacySkill>
</student>
<student id="2">
<name>Adam Davidson</name>
<legacySkill>Cobol, MainFrame</legacySkill>
</student>
<student id="3">
<name>Charles Boyer</name>
<legacySkill>HTML, Photoshop</legacySkill>
</student>
</wclass>
AJAX and XML Code (1/4)
<html>
<head>
<title>AJAX and XML</title>
<script language="javascript">
var xhr = false;
function GetXmlHttpObject(){
var xmlHttp=null;
try {
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
} catch (e) {
// Internet Explorer
try {
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
AJAX and XML Code (2/4)
function getPage (url) {
xhr = GetXmlHttpObject();
if (!xhr) {
alert ('XMLHttp failed to instantiate');
return false;
}
xhr.onreadystatechange = statusCheck;
xhr.open ('GET', url, true);
xhr.send (null);
}
AJAX and XML Code (3/4)
function statusCheck() {
if (xhr.readyState == 4) {
if (xhr.status == 200) {
var nodes=xhr.responseXML.getElementsByTagName("student");
j = 1;
for (i=0; i<nodes.length; i++) {
var student = nodes.item(i);
document.getElementById(j++).innerHTML= (i+1) + ". Student
name:" +
student.firstChild.nextSibling.firstChild.nodeValue + " skill:" +
student.lastChild.previousSibling.firstChild.nodeValue;
}
} else {
alert ('The request could not be fulfilled.');
}
}
}
</script>
AJAX and XML Code (4/4)
</head>
<body>
<input id=button2 onclick=
"getPage ('http:///localhost/~Macbook/json/
webstudents.xml')" type=button
value="Get the XML Document" name=button2>
<br/>
<div id=1></div></p>
<div id=2></div></p>
<div id=3></div></p>
</body>
</html>
AJAX and XML Code Result
JSON File
{ "wclass": [
{"student": { "@attributes" : {"id" : "1” },
"name": "Linda Jones",
"legacySkill": "Access VB 5.0"
} },
{"student": { "@attributes" : { "id": "2” },
"name": "Adam Davidson",
"legacySkill": "Cobol, MainFrame"
} },
{"student": { "@attributes" : { "id": "3” },
"name": "Charles Boyer",
"legacySkill": "HTML, XML"
}
}
]
}
JSON and JQuery
<script type="text/javascript" src="jquery-1.5.js"></script>
<script type="text/javascript">
...
function statusCheck() {
if (xhr.readyState == 4) {
if (xhr.status == 200) {
var jsonT = xhr.responseText;
var obj = jQuery.parseJSON(jsonT);
var wclass = obj.wclass;
j = 1;
for (i = 0; i < wclass.length; i++) {
document.getElementById(j+
+).innerHTML=
(i+1) + ". Student name: " +
wclass[i].student.name + " skill: " + wclass[i].student.legacySkill
+ "<br/>”; }}}}
JSON and JQuery Result
• 
Using JSON in the Google Data Protocol

•  The feed is represented as a JSON object; each
nested element or attribute is represented as a
name/value property of the object.
•  Attributes are converted to String properties.
•  Child elements are converted to Object properties.
•  Elements that may appear more than once are
converted to Array properties.
•  Text values of tags are converted to $t properties#
Sample Google Data in JSON
{
"version": "1.0",
"encoding": "UTF-8",
"feed": {
"xmlns": "http://www.w3.org/2005/Atom",
"xmlns$openSearch": "http://a9.com/-/spec/
opensearchrss/1.0/",
"xmlns$gd": "http://schemas.google.com/g/2005",
"xmlns$gCal": "http://schemas.google.com/gCal/
2005",
"id": {"$t": "..."},
"updated": {"$t": "2006-11-12T21:25:30.000Z"},
"title": { "type": "text", ...
Requesting and Using JSON Feeds
•  Atom is Google Data's default format. If you don't
specify an alt parameter in your request, then you
receive an Atom feed
•  To request a response in JSON format, use
the alt=json parameter.
•  For example, to request Google's developer
calendar feed in JSON format, send the following
query:
•  http://www.google.com/calendar/feeds/developercalendar@google.com/public/full?alt=json
Getting JSON Feeds in Javascript
• To request a response that wraps JSON in a script
tag, use the alt=json-in-script parameter and add a
callback function by adding
the callback=functionName parameter.
• http://www.google.com/calendar/feeds/developercalendar@google.com/public/full?alt=json-inscript&callback=myFunction
Sample Script to Get JSON Feeds (1/2)
<h3>Upcoming Google Developer Events</h3>
<div id="agenda"></div>
<script>
function listEvents(root) {
var feed = root.feed;
var entries = feed.entry || [];
var html = ['<ul>'];
for (var i = 0; i < entries.length; ++i) {
var entry = entries[i];
var title = entry.title.$t;
var start = (entry['gd$when']) ? entry['gd$when']
[0].startTime : ""; html.push('<li>', start, ' ', title, '</li>'); }
Sample Script to Get JSON Feeds (2/2)
html.push('</ul>');
document.getElementById("agenda").innerHTML =
html.join(""); }
</script>
<script src="http://www.google.com/calendar/feeds/
developer-calendar@google.com/public/full?alt=jsonin-script&callback=listEvents">
</script>
Google Data Sample Script Result
• 
Encoding JSON in PHP (1/3)
<?php	
  
	
  '{"fruits":'.json_encode(array("Apple",	
  
"Banana",	
  "Pear")).'}‘;	
  	
  	
  	
  	
  	
  	
  	
  	
  
?>	
  
	
  

35
Encoding JSON in PHP (2/3)
<?php	
  
	
  	
  echo	
  '{"numbers":'.json_encode(array(4	
  =>	
  
"four",	
  8	
  =>	
  "eight")).'}’;	
  	
  	
  	
  
?>	
  
	
  

36
Encoding JSON in PHP (3/3)
<?php	
  
	
  echo	
  '{"fruits":'.json_encode(array("apples"	
  =>	
  true,	
  
"bananas"	
  =>	
  null)).'}';	
  
?>	
  
	
  

37
Encode Class to JSON in PHP (1/2)
<?php	
  
class	
  User	
  {	
  
	
  	
  	
  	
  public	
  $firstname	
  =	
  "";	
  
	
  	
  	
  	
  public	
  $lastname	
  	
  =	
  "";	
  
	
  	
  	
  	
  public	
  $birthdate	
  =	
  "";	
  
}	
  
$user	
  =	
  new	
  User();	
  
$user-­‐>firstname	
  =	
  "foo";	
  
$user-­‐>lastname	
  	
  =	
  "bar";	
  
json_encode($user);	
  
$user-­‐>birthdate	
  =	
  new	
  DateTime();	
  
echo	
  json_encode($user);	
  
?>	
  

	
  

38
Encode Class to JSON in PHP (2/2)
<?php	
  
class	
  User	
  {	
  
	
  	
  	
  	
  public	
  $pub	
  =	
  "Mister	
  X.";	
  
	
  	
  	
  	
  protected	
  $pro	
  =	
  "hidden";	
  
	
  	
  	
  	
  private	
  $priv	
  =	
  "hidden	
  too”;	
  
	
  	
  	
  	
  public	
  $func;	
  
	
  	
  	
  	
  public	
  $notUsed;	
  
	
  	
  	
  	
  public	
  func[on	
  __construct()	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  $this-­‐>func	
  =	
  func[on()	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  return	
  "Foo";	
  
	
  	
  	
  	
  	
  	
  	
  	
  };	
  
	
  	
  	
  	
  }	
  
}	
  
$user	
  =	
  new	
  User();	
  
//	
  Returns:	
  {"pub":"Mister	
  X.","func":{},"notUsed":null}	
  
echo	
  json_encode($user);	
  
?>	
  
	
  

39
The $option bitmask
Without	
  bitmask	
  
•  	
  echo	
  
json_encode(array("Starsky	
  
&	
  Hutch",	
  "123456"));	
  

With	
  bitmask	
  
•  echo	
  json_encode(array("Starsky	
  
&	
  Hutch",	
  "123456"),	
  
JSON_NUMERIC_CHECK	
  |	
  
JSON_FORCE_OBJECT);	
  

40
Throwing PHP Exception Through JSON
<?php	
  
try	
  {	
  
	
  	
  	
  	
  if	
  (0	
  ==	
  0)	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  throw	
  new	
  Excep[on('Test	
  error',	
  123);	
  
	
  	
  	
  	
  }	
  
	
  	
  	
  	
  echo	
  json_encode(array(	
  
	
  	
  	
  	
  	
  	
  	
  	
  'result'	
  =>	
  'vanilla!',	
  
	
  	
  	
  	
  ));	
  
}	
  catch	
  (Excep[on	
  $e)	
  {	
  
	
  	
  	
  	
  echo	
  json_encode(array(	
  
	
  	
  	
  	
  	
  	
  	
  	
  'error'	
  =>	
  array(	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  'msg'	
  =>	
  $e-­‐>getMessage(),	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  'code'	
  =>	
  $e-­‐>getCode(),	
  
	
  	
  	
  	
  	
  	
  	
  	
  ),	
  
	
  	
  	
  	
  ));	
  
}	
  
?>	
  
	
  

41
Encoding Data in UTF-8
•  If	
  the	
  incoming	
  string	
  is	
  not	
  under	
  your	
  
control,	
  you	
  can	
  use	
  the	
  uz8_encode	
  func[on	
  
to	
  convert	
  it	
  into	
  uz8	
  
<?php	
  
	
  	
  	
  	
  	
  	
  	
  	
  $payload	
  =	
  array("กานดา	
  รุณนะพงศา	
  สายแก้ว");	
  
	
  	
  	
  	
  	
  	
  	
  	
  echo	
  uz8_encode(json_encode($payload,	
  JSON_FORCE_OBJECT));	
  
?>	
  
	
  

42
Decode JSON in PHP (1/3)
<?php	
  
$string	
  =	
  '{"foo":	
  "bar",	
  "cool":	
  "a"r"}';	
  
$result	
  =	
  json_decode($string);	
  
//	
  Result:	
  object(stdClass)#1	
  (2)	
  {	
  ["foo"]=>	
  string(3)	
  
"bar"	
  ["cool"]=>	
  string(4)	
  "a"r"	
  }	
  
var_dump($result);	
  
//	
  Prints	
  "bar"	
  
echo	
  $result-­‐>foo;	
  
echo	
  "<br/>”;	
  
//	
  Prints	
  "a"r"	
  
echo	
  $result-­‐>cool;	
  
?>	
  
	
  

43
Decode JSON in PHP (2/3)
•  If you want to get an associative array back instead, set
the second parameter to true:
<?php
$string = '{"foo": "bar", "cool": "attr"}';
$result = json_decode($string, true);
// Result: array(2) { ["foo"]=> string(3) "bar" ["cool"]=> string(4) "attr" }
var_dump($result);
// Prints "bar"
echo $result['foo'];
echo "<br/>";
// Prints "attr"
echo $result['cool'];
?>
44
Decode JSON in PHP (3/3)
•  If	
  you	
  expect	
  a	
  very	
  large	
  nested	
  JSON	
  
document,	
  you	
  can	
  limit	
  the	
  recursion	
  depth	
  
to	
  a	
  certain	
  level	
  
•  The	
  func[on	
  will	
  return	
  null	
  and	
  stops	
  parsing	
  
if	
  the	
  document	
  is	
  deeper	
  than	
  the	
  given	
  
depth	
  

45
Decode with Depth Levels
Code	
  and	
  Output	
  (Depth	
  =	
  2)	
  
<?php	
  
$string	
  =	
  '{"foo":	
  {"bar":	
  {"cool":	
  
"value"}}}';	
  
$result	
  =	
  json_decode($string,	
  true,	
  2);	
  
//	
  Result:	
  null	
  
var_dump($result);	
  
?>	
  
	
  

Code	
  and	
  Output	
  (Depth	
  =	
  4)	
  
<?php
$string = '{"foo": {"bar": {"cool":
"value"}}}';
$result = json_decode($string, true, 4);
// Result: null
var_dump($result);
?>

46
References
• 
• 
• 
• 
• 
• 
• 
• 
• 
• 
• 
• 

Introducing JSON, http://www.json.org/
JSON in JavaScript, http://www.json.org/js.html
http://en.wikipedia.org/wiki/JSON
http://secretgeek.net/json_3mins.asp
http://funkatron.com/site/comments/safely-parsing-json-in-javascript/
http://yuiblog.com/blog/2007/04/10/json-and-browser-security/
http://www.developer.com/lang/jscript/article.php/3596836/Speeding-UpAJAX-with-JSON.htm
http://www.devarticles.com/c/a/JavaScript/AJAX-with-JSON/
http://developer.yahoo.com/javascript/json.html
http://www.jsonlint.com/
http://nitschinger.at/Handling-JSON-like-a-boss-in-PHP
http://stackoverflow.com/questions/12693423/clean-way-to-throw-phpexception-through-jquery-ajax-and-json

More Related Content

What's hot

Introduction to ajax
Introduction  to  ajaxIntroduction  to  ajax
Introduction to ajax
Pihu Goel
 
Javascript 101
Javascript 101Javascript 101
Javascript 101
Shlomi Komemi
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
David Parsons
 
Javascript
JavascriptJavascript
Javascript
Sun Technlogies
 
Javascript basics
Javascript basicsJavascript basics
Javascript basics
shreesenthil
 
Java Script Object Notation (JSON)
Java Script Object Notation (JSON)Java Script Object Notation (JSON)
Java Script Object Notation (JSON)
Adnan Sohail
 
Php.ppt
Php.pptPhp.ppt
Php.ppt
Nidhi mishra
 
Javascript
JavascriptJavascript
Javascript
Nagarajan
 
Introduction to the Web API
Introduction to the Web APIIntroduction to the Web API
Introduction to the Web API
Brad Genereaux
 
Javascript
JavascriptJavascript
Javascript
Mayank Bhatt
 
The New JavaScript: ES6
The New JavaScript: ES6The New JavaScript: ES6
The New JavaScript: ES6
Rob Eisenberg
 
JavaScript - Chapter 8 - Objects
 JavaScript - Chapter 8 - Objects JavaScript - Chapter 8 - Objects
JavaScript - Chapter 8 - Objects
WebStackAcademy
 
Web api
Web apiWeb api
Javascript essentials
Javascript essentialsJavascript essentials
Javascript essentials
Bedis ElAchèche
 
JavaScript - Chapter 4 - Types and Statements
 JavaScript - Chapter 4 - Types and Statements JavaScript - Chapter 4 - Types and Statements
JavaScript - Chapter 4 - Types and Statements
WebStackAcademy
 
Json
JsonJson
Javascript
JavascriptJavascript
Javascript
Manav Prasad
 
JavaScript - Chapter 12 - Document Object Model
  JavaScript - Chapter 12 - Document Object Model  JavaScript - Chapter 12 - Document Object Model
JavaScript - Chapter 12 - Document Object Model
WebStackAcademy
 
Ajax ppt
Ajax pptAjax ppt
JavaScript Basic
JavaScript BasicJavaScript Basic
JavaScript Basic
Finsa Nurpandi
 

What's hot (20)

Introduction to ajax
Introduction  to  ajaxIntroduction  to  ajax
Introduction to ajax
 
Javascript 101
Javascript 101Javascript 101
Javascript 101
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
 
Javascript
JavascriptJavascript
Javascript
 
Javascript basics
Javascript basicsJavascript basics
Javascript basics
 
Java Script Object Notation (JSON)
Java Script Object Notation (JSON)Java Script Object Notation (JSON)
Java Script Object Notation (JSON)
 
Php.ppt
Php.pptPhp.ppt
Php.ppt
 
Javascript
JavascriptJavascript
Javascript
 
Introduction to the Web API
Introduction to the Web APIIntroduction to the Web API
Introduction to the Web API
 
Javascript
JavascriptJavascript
Javascript
 
The New JavaScript: ES6
The New JavaScript: ES6The New JavaScript: ES6
The New JavaScript: ES6
 
JavaScript - Chapter 8 - Objects
 JavaScript - Chapter 8 - Objects JavaScript - Chapter 8 - Objects
JavaScript - Chapter 8 - Objects
 
Web api
Web apiWeb api
Web api
 
Javascript essentials
Javascript essentialsJavascript essentials
Javascript essentials
 
JavaScript - Chapter 4 - Types and Statements
 JavaScript - Chapter 4 - Types and Statements JavaScript - Chapter 4 - Types and Statements
JavaScript - Chapter 4 - Types and Statements
 
Json
JsonJson
Json
 
Javascript
JavascriptJavascript
Javascript
 
JavaScript - Chapter 12 - Document Object Model
  JavaScript - Chapter 12 - Document Object Model  JavaScript - Chapter 12 - Document Object Model
JavaScript - Chapter 12 - Document Object Model
 
Ajax ppt
Ajax pptAjax ppt
Ajax ppt
 
JavaScript Basic
JavaScript BasicJavaScript Basic
JavaScript Basic
 

Viewers also liked

Introduction to JSON & AJAX
Introduction to JSON & AJAXIntroduction to JSON & AJAX
Introduction to JSON & AJAX
Collaboration Technologies
 
External Data Access with jQuery
External Data Access with jQueryExternal Data Access with jQuery
External Data Access with jQueryDoncho Minkov
 
Design Beautiful REST + JSON APIs
Design Beautiful REST + JSON APIsDesign Beautiful REST + JSON APIs
Design Beautiful REST + JSON APIs
Stormpath
 
JSON and REST
JSON and RESTJSON and REST
JSON and REST
Robert MacLean
 
'Less' css
'Less' css'Less' css
'Less' css
Mayur Mohite
 
Preprocessor CSS: SASS
Preprocessor CSS: SASSPreprocessor CSS: SASS
Preprocessor CSS: SASS
Geoffroy Baylaender
 
Ajax xml json
Ajax xml jsonAjax xml json
Ajax xml json
Andrii Siusko
 
분데스리가일정→→W­Е­4­9.сом←←유료픽キ분데스리가キ프리메라리가
분데스리가일정→→W­Е­4­9.сом←←유료픽キ분데스리가キ프리메라리가분데스리가일정→→W­Е­4­9.сом←←유료픽キ분데스리가キ프리메라리가
분데스리가일정→→W­Е­4­9.сом←←유료픽キ분데스리가キ프리메라리가
itsming
 
C++ L02-Conversion+enum+Operators
C++ L02-Conversion+enum+OperatorsC++ L02-Conversion+enum+Operators
C++ L02-Conversion+enum+Operators
Mohammad Shaker
 
JSON - Quick Overview
JSON - Quick OverviewJSON - Quick Overview
JSON - Quick Overview
Signure Technologies
 
AJAX and JSON
AJAX and JSONAJAX and JSON
AJAX and JSON
Julie Iskander
 
Simplify AJAX using jQuery
Simplify AJAX using jQuerySimplify AJAX using jQuery
Simplify AJAX using jQuerySiva Arunachalam
 
JSON and AJAX JumpStart
JSON and AJAX JumpStartJSON and AJAX JumpStart
JSON and AJAX JumpStart
dominion
 
Dynamic webpages using AJAX & JSON
Dynamic webpages using AJAX & JSONDynamic webpages using AJAX & JSON
Dynamic webpages using AJAX & JSON
Christiaan Rakowski
 
개발자와 협업하기 위한 API의 이해 - API를 준비하는 금성인을 위한 안내서
개발자와 협업하기 위한 API의 이해 - API를 준비하는 금성인을 위한 안내서개발자와 협업하기 위한 API의 이해 - API를 준비하는 금성인을 위한 안내서
개발자와 협업하기 위한 API의 이해 - API를 준비하는 금성인을 위한 안내서동수 장
 
Ajax by Examples 2
Ajax by Examples 2Ajax by Examples 2
Ajax by Examples 2
Yenwen Feng
 
One-day-codelab
One-day-codelabOne-day-codelab
One-day-codelab
WebFrameworks
 

Viewers also liked (20)

Introduction to JSON & AJAX
Introduction to JSON & AJAXIntroduction to JSON & AJAX
Introduction to JSON & AJAX
 
Json tutorial
Json tutorialJson tutorial
Json tutorial
 
External Data Access with jQuery
External Data Access with jQueryExternal Data Access with jQuery
External Data Access with jQuery
 
Design Beautiful REST + JSON APIs
Design Beautiful REST + JSON APIsDesign Beautiful REST + JSON APIs
Design Beautiful REST + JSON APIs
 
JSON and REST
JSON and RESTJSON and REST
JSON and REST
 
'Less' css
'Less' css'Less' css
'Less' css
 
Preprocessor CSS: SASS
Preprocessor CSS: SASSPreprocessor CSS: SASS
Preprocessor CSS: SASS
 
Ajax xml json
Ajax xml jsonAjax xml json
Ajax xml json
 
분데스리가일정→→W­Е­4­9.сом←←유료픽キ분데스리가キ프리메라리가
분데스리가일정→→W­Е­4­9.сом←←유료픽キ분데스리가キ프리메라리가분데스리가일정→→W­Е­4­9.сом←←유료픽キ분데스리가キ프리메라리가
분데스리가일정→→W­Е­4­9.сом←←유료픽キ분데스리가キ프리메라리가
 
Inside jQuery (2011)
Inside jQuery (2011)Inside jQuery (2011)
Inside jQuery (2011)
 
C++ L02-Conversion+enum+Operators
C++ L02-Conversion+enum+OperatorsC++ L02-Conversion+enum+Operators
C++ L02-Conversion+enum+Operators
 
JSON - Quick Overview
JSON - Quick OverviewJSON - Quick Overview
JSON - Quick Overview
 
AJAX and JSON
AJAX and JSONAJAX and JSON
AJAX and JSON
 
Simplify AJAX using jQuery
Simplify AJAX using jQuerySimplify AJAX using jQuery
Simplify AJAX using jQuery
 
JSON and AJAX JumpStart
JSON and AJAX JumpStartJSON and AJAX JumpStart
JSON and AJAX JumpStart
 
Dynamic webpages using AJAX & JSON
Dynamic webpages using AJAX & JSONDynamic webpages using AJAX & JSON
Dynamic webpages using AJAX & JSON
 
개발자와 협업하기 위한 API의 이해 - API를 준비하는 금성인을 위한 안내서
개발자와 협업하기 위한 API의 이해 - API를 준비하는 금성인을 위한 안내서개발자와 협업하기 위한 API의 이해 - API를 준비하는 금성인을 위한 안내서
개발자와 협업하기 위한 API의 이해 - API를 준비하는 금성인을 위한 안내서
 
Ajax by Examples 2
Ajax by Examples 2Ajax by Examples 2
Ajax by Examples 2
 
One-day-codelab
One-day-codelabOne-day-codelab
One-day-codelab
 
08 ajax
08 ajax08 ajax
08 ajax
 

Similar to Introduction to JSON

Basics of JSON (JavaScript Object Notation) with examples
Basics of JSON (JavaScript Object Notation) with examplesBasics of JSON (JavaScript Object Notation) with examples
Basics of JSON (JavaScript Object Notation) with examples
Sanjeev Kumar Jaiswal
 
Json tutorial, a beguiner guide
Json tutorial, a beguiner guideJson tutorial, a beguiner guide
Json tutorial, a beguiner guide
Rafael Montesinos Muñoz
 
JSON-(JavaScript Object Notation)
JSON-(JavaScript Object Notation)JSON-(JavaScript Object Notation)
JSON-(JavaScript Object Notation)
Skillwise Group
 
Json
JsonJson
JSON - (English)
JSON - (English)JSON - (English)
JSON - (English)
Senior Dev
 
Hands on JSON
Hands on JSONHands on JSON
Hands on JSON
Octavian Nadolu
 
json.ppt download for free for college project
json.ppt download for free for college projectjson.ppt download for free for college project
json.ppt download for free for college project
AmitSharma397241
 
JSON
JSONJSON
JSON
Yoga Raja
 
JSON Fuzzing: New approach to old problems
JSON Fuzzing: New  approach to old problemsJSON Fuzzing: New  approach to old problems
JSON Fuzzing: New approach to old problemstitanlambda
 
Advanced Json
Advanced JsonAdvanced Json
Advanced Json
guestfd7d7c
 
Cordova training : Day 4 - Advanced Javascript
Cordova training : Day 4 - Advanced JavascriptCordova training : Day 4 - Advanced Javascript
Cordova training : Day 4 - Advanced Javascript
Binu Paul
 
module 2.pptx for full stack mobile development application on backend applic...
module 2.pptx for full stack mobile development application on backend applic...module 2.pptx for full stack mobile development application on backend applic...
module 2.pptx for full stack mobile development application on backend applic...
HemaSenthil5
 
JavaScript Fundamentals & JQuery
JavaScript Fundamentals & JQueryJavaScript Fundamentals & JQuery
JavaScript Fundamentals & JQueryJamshid Hashimi
 
JavaScript Lessons 2023 V2
JavaScript Lessons 2023 V2JavaScript Lessons 2023 V2
JavaScript Lessons 2023 V2
Laurence Svekis ✔
 
Json - ideal for data interchange
Json - ideal for data interchangeJson - ideal for data interchange
Json - ideal for data interchange
Christoph Santschi
 
Working with JSON.pptx
Working with JSON.pptxWorking with JSON.pptx
Working with JSON.pptx
Lovely Professional University
 

Similar to Introduction to JSON (20)

Basics of JSON (JavaScript Object Notation) with examples
Basics of JSON (JavaScript Object Notation) with examplesBasics of JSON (JavaScript Object Notation) with examples
Basics of JSON (JavaScript Object Notation) with examples
 
Json tutorial, a beguiner guide
Json tutorial, a beguiner guideJson tutorial, a beguiner guide
Json tutorial, a beguiner guide
 
Json
JsonJson
Json
 
JSON-(JavaScript Object Notation)
JSON-(JavaScript Object Notation)JSON-(JavaScript Object Notation)
JSON-(JavaScript Object Notation)
 
Json
JsonJson
Json
 
JSON - (English)
JSON - (English)JSON - (English)
JSON - (English)
 
Hands on JSON
Hands on JSONHands on JSON
Hands on JSON
 
json.ppt download for free for college project
json.ppt download for free for college projectjson.ppt download for free for college project
json.ppt download for free for college project
 
Week3
Week3Week3
Week3
 
JSON
JSONJSON
JSON
 
JSON Fuzzing: New approach to old problems
JSON Fuzzing: New  approach to old problemsJSON Fuzzing: New  approach to old problems
JSON Fuzzing: New approach to old problems
 
Advanced Json
Advanced JsonAdvanced Json
Advanced Json
 
Cordova training : Day 4 - Advanced Javascript
Cordova training : Day 4 - Advanced JavascriptCordova training : Day 4 - Advanced Javascript
Cordova training : Day 4 - Advanced Javascript
 
Json
JsonJson
Json
 
module 2.pptx for full stack mobile development application on backend applic...
module 2.pptx for full stack mobile development application on backend applic...module 2.pptx for full stack mobile development application on backend applic...
module 2.pptx for full stack mobile development application on backend applic...
 
JavaScript Fundamentals & JQuery
JavaScript Fundamentals & JQueryJavaScript Fundamentals & JQuery
JavaScript Fundamentals & JQuery
 
JavaScript Lessons 2023 V2
JavaScript Lessons 2023 V2JavaScript Lessons 2023 V2
JavaScript Lessons 2023 V2
 
Json the-x-in-ajax1588
Json the-x-in-ajax1588Json the-x-in-ajax1588
Json the-x-in-ajax1588
 
Json - ideal for data interchange
Json - ideal for data interchangeJson - ideal for data interchange
Json - ideal for data interchange
 
Working with JSON.pptx
Working with JSON.pptxWorking with JSON.pptx
Working with JSON.pptx
 

More from Kanda Runapongsa Saikaew

ความรู้ไอทีช่วยเลี้ยงลูกได้
ความรู้ไอทีช่วยเลี้ยงลูกได้ความรู้ไอทีช่วยเลี้ยงลูกได้
ความรู้ไอทีช่วยเลี้ยงลูกได้
Kanda Runapongsa Saikaew
 
Google Apps Basic for Education
Google Apps Basic for Education Google Apps Basic for Education
Google Apps Basic for Education
Kanda Runapongsa Saikaew
 
Moodle basics
Moodle basicsMoodle basics
Introduction to Google App Engine
Introduction to Google App EngineIntroduction to Google App Engine
Introduction to Google App Engine
Kanda Runapongsa Saikaew
 
Android dev tips
Android dev tipsAndroid dev tips
Android dev tips
Kanda Runapongsa Saikaew
 
Introduction to Google+
Introduction to Google+Introduction to Google+
Introduction to Google+
Kanda Runapongsa Saikaew
 
ใช้ไอทีอย่างไรให้เป็นประโยชน์ เหมาะสม และปลอดภัย
ใช้ไอทีอย่างไรให้เป็นประโยชน์ เหมาะสม และปลอดภัยใช้ไอทีอย่างไรให้เป็นประโยชน์ เหมาะสม และปลอดภัย
ใช้ไอทีอย่างไรให้เป็นประโยชน์ เหมาะสม และปลอดภัยKanda Runapongsa Saikaew
 
บริการไอทีของมหาวิทยาลัยขอนแก่นเพื่อนักศึกษา
บริการไอทีของมหาวิทยาลัยขอนแก่นเพื่อนักศึกษาบริการไอทีของมหาวิทยาลัยขอนแก่นเพื่อนักศึกษา
บริการไอทีของมหาวิทยาลัยขอนแก่นเพื่อนักศึกษาKanda Runapongsa Saikaew
 
Baby Health Journal
Baby Health Journal Baby Health Journal
Baby Health Journal
Kanda Runapongsa Saikaew
 
Using Facebook as a Supplementary Tool for Teaching and Learning
Using Facebook as a Supplementary Tool for Teaching and LearningUsing Facebook as a Supplementary Tool for Teaching and Learning
Using Facebook as a Supplementary Tool for Teaching and Learning
Kanda Runapongsa Saikaew
 
วิธีการติดตั้งและใช้ Dropbox
วิธีการติดตั้งและใช้ Dropboxวิธีการติดตั้งและใช้ Dropbox
วิธีการติดตั้งและใช้ Dropbox
Kanda Runapongsa Saikaew
 
Using Facebook and Google Docs for Teaching and Sharing Information
Using Facebook and Google Docs for Teaching and Sharing InformationUsing Facebook and Google Docs for Teaching and Sharing Information
Using Facebook and Google Docs for Teaching and Sharing Information
Kanda Runapongsa Saikaew
 
เครื่องมือเทคโนโลยีสารสนเทศฟรีที่น่าใช้
เครื่องมือเทคโนโลยีสารสนเทศฟรีที่น่าใช้เครื่องมือเทคโนโลยีสารสนเทศฟรีที่น่าใช้
เครื่องมือเทคโนโลยีสารสนเทศฟรีที่น่าใช้
Kanda Runapongsa Saikaew
 
การใช้เฟซบุ๊กเพื่อแลกเปลี่ยนเรียนรู้
การใช้เฟซบุ๊กเพื่อแลกเปลี่ยนเรียนรู้การใช้เฟซบุ๊กเพื่อแลกเปลี่ยนเรียนรู้
การใช้เฟซบุ๊กเพื่อแลกเปลี่ยนเรียนรู้Kanda Runapongsa Saikaew
 
คู่มือการใช้ Dropbox
คู่มือการใช้ Dropboxคู่มือการใช้ Dropbox
คู่มือการใช้ Dropbox
Kanda Runapongsa Saikaew
 
การใช้เฟซบุ๊กเพื่อการเรียนการสอน
การใช้เฟซบุ๊กเพื่อการเรียนการสอนการใช้เฟซบุ๊กเพื่อการเรียนการสอน
การใช้เฟซบุ๊กเพื่อการเรียนการสอน
Kanda Runapongsa Saikaew
 
การใช้เฟซบุ๊กอย่างปลอดภัยและสร้างสรรค์
การใช้เฟซบุ๊กอย่างปลอดภัยและสร้างสรรค์การใช้เฟซบุ๊กอย่างปลอดภัยและสร้างสรรค์
การใช้เฟซบุ๊กอย่างปลอดภัยและสร้างสรรค์
Kanda Runapongsa Saikaew
 
Social Media (โซเชียลมีเดีย)
Social Media (โซเชียลมีเดีย)Social Media (โซเชียลมีเดีย)
Social Media (โซเชียลมีเดีย)Kanda Runapongsa Saikaew
 
Mobile Application for Education (โมบายแอปพลิเคชันเพื่อการศึกษา)
Mobile Application for Education (โมบายแอปพลิเคชันเพื่อการศึกษา)Mobile Application for Education (โมบายแอปพลิเคชันเพื่อการศึกษา)
Mobile Application for Education (โมบายแอปพลิเคชันเพื่อการศึกษา)
Kanda Runapongsa Saikaew
 

More from Kanda Runapongsa Saikaew (20)

ความรู้ไอทีช่วยเลี้ยงลูกได้
ความรู้ไอทีช่วยเลี้ยงลูกได้ความรู้ไอทีช่วยเลี้ยงลูกได้
ความรู้ไอทีช่วยเลี้ยงลูกได้
 
Google Apps Basic for Education
Google Apps Basic for Education Google Apps Basic for Education
Google Apps Basic for Education
 
Moodle basics
Moodle basicsMoodle basics
Moodle basics
 
Thai socialmedia
Thai socialmediaThai socialmedia
Thai socialmedia
 
Introduction to Google App Engine
Introduction to Google App EngineIntroduction to Google App Engine
Introduction to Google App Engine
 
Android dev tips
Android dev tipsAndroid dev tips
Android dev tips
 
Introduction to Google+
Introduction to Google+Introduction to Google+
Introduction to Google+
 
ใช้ไอทีอย่างไรให้เป็นประโยชน์ เหมาะสม และปลอดภัย
ใช้ไอทีอย่างไรให้เป็นประโยชน์ เหมาะสม และปลอดภัยใช้ไอทีอย่างไรให้เป็นประโยชน์ เหมาะสม และปลอดภัย
ใช้ไอทีอย่างไรให้เป็นประโยชน์ เหมาะสม และปลอดภัย
 
บริการไอทีของมหาวิทยาลัยขอนแก่นเพื่อนักศึกษา
บริการไอทีของมหาวิทยาลัยขอนแก่นเพื่อนักศึกษาบริการไอทีของมหาวิทยาลัยขอนแก่นเพื่อนักศึกษา
บริการไอทีของมหาวิทยาลัยขอนแก่นเพื่อนักศึกษา
 
Baby Health Journal
Baby Health Journal Baby Health Journal
Baby Health Journal
 
Using Facebook as a Supplementary Tool for Teaching and Learning
Using Facebook as a Supplementary Tool for Teaching and LearningUsing Facebook as a Supplementary Tool for Teaching and Learning
Using Facebook as a Supplementary Tool for Teaching and Learning
 
วิธีการติดตั้งและใช้ Dropbox
วิธีการติดตั้งและใช้ Dropboxวิธีการติดตั้งและใช้ Dropbox
วิธีการติดตั้งและใช้ Dropbox
 
Using Facebook and Google Docs for Teaching and Sharing Information
Using Facebook and Google Docs for Teaching and Sharing InformationUsing Facebook and Google Docs for Teaching and Sharing Information
Using Facebook and Google Docs for Teaching and Sharing Information
 
เครื่องมือเทคโนโลยีสารสนเทศฟรีที่น่าใช้
เครื่องมือเทคโนโลยีสารสนเทศฟรีที่น่าใช้เครื่องมือเทคโนโลยีสารสนเทศฟรีที่น่าใช้
เครื่องมือเทคโนโลยีสารสนเทศฟรีที่น่าใช้
 
การใช้เฟซบุ๊กเพื่อแลกเปลี่ยนเรียนรู้
การใช้เฟซบุ๊กเพื่อแลกเปลี่ยนเรียนรู้การใช้เฟซบุ๊กเพื่อแลกเปลี่ยนเรียนรู้
การใช้เฟซบุ๊กเพื่อแลกเปลี่ยนเรียนรู้
 
คู่มือการใช้ Dropbox
คู่มือการใช้ Dropboxคู่มือการใช้ Dropbox
คู่มือการใช้ Dropbox
 
การใช้เฟซบุ๊กเพื่อการเรียนการสอน
การใช้เฟซบุ๊กเพื่อการเรียนการสอนการใช้เฟซบุ๊กเพื่อการเรียนการสอน
การใช้เฟซบุ๊กเพื่อการเรียนการสอน
 
การใช้เฟซบุ๊กอย่างปลอดภัยและสร้างสรรค์
การใช้เฟซบุ๊กอย่างปลอดภัยและสร้างสรรค์การใช้เฟซบุ๊กอย่างปลอดภัยและสร้างสรรค์
การใช้เฟซบุ๊กอย่างปลอดภัยและสร้างสรรค์
 
Social Media (โซเชียลมีเดีย)
Social Media (โซเชียลมีเดีย)Social Media (โซเชียลมีเดีย)
Social Media (โซเชียลมีเดีย)
 
Mobile Application for Education (โมบายแอปพลิเคชันเพื่อการศึกษา)
Mobile Application for Education (โมบายแอปพลิเคชันเพื่อการศึกษา)Mobile Application for Education (โมบายแอปพลิเคชันเพื่อการศึกษา)
Mobile Application for Education (โมบายแอปพลิเคชันเพื่อการศึกษา)
 

Recently uploaded

UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
Peter Spielvogel
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
UiPathCommunity
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 

Recently uploaded (20)

UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 

Introduction to JSON

  • 1. Introduction to JSON Dr. Kanda Runapongsa Saikaew Department of Computer Engineering Khon Kaen University http://gear.kku.ac.th/~krunapon/xmlws 1 1
  • 2. Agenda •  •  •  •  •  •  What is JSON? JSON vs. XML JSON Tutorial JSON and AJAX Using JSON with Google Data Protocol PHP and JSON •  Encoding •  Decoding
  • 3. What is JSON? •  JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write •  It is easy for machines to parse and generate. •  JSON is a text format that is completely language independent •  JSON is built on two structures: A collection of name/value pairs. In various languages, this is realized as an object, record, struct, dictionary, hash table, keyed list, or associative array. o  An ordered list of values. In most languages, this is realized as an array, vector, list, or sequence. o 
  • 4. JSON Forms: An object •  An object is an unordered set of name/value pairs •  An object begins with { (left brace) and ends with } (right brace) •  Each name is followed by: (colon) and the name/ value pairs are separated by , (comma)
  • 5. JSON Forms: An Array •  An array is an ordered collection of values •  An array begins with [ (left bracket) and ends with ] (right bracket) •  Values are separated by , (comma).
  • 6. JSON Forms: A Value •  A value can be a string in double quotes, or a number, or true or false or null, or an object or an array •  These structures can be nested.
  • 7. JSON Forms: A String •  A string is a sequence of zero or more Unicode characters, wrapped in double quotes, using backslash escapes •  A character is represented as a single character string •  A string is very much like a C or Java string
  • 8. JSON Forms: A Number •  A number is very much like a C or Java number, except that the octal and hexadecimal formats are not used
  • 11. Squiggles, Squares, Colons, and Commas 1. Squiggly brackets act as 'containers' o  {...} • 2. Square brackets holds arrays o  [...] • 3. Names and values are separated by a colon o  name:value • 4. Array elements are separated by commas o  [member1, member2]
  • 12. JSON is like XML because 1. They are both 'self-describing' meaning that values are named, and thus 'human readable' 2. Both are hierarchical. (i.e. You can have values within values.) 3. Both can be parsed and used by lots of programming languages 4. Both can be passed around using AJAX (i.e. httpWebRequest)
  • 13. JSON is Unlike XML because 1. XML uses angle brackets, with a tag name at the start and end of an element: JSON uses squiggly brackets with the name only at the beginning of the element. 2. JSON is less verbose so it's definitely quicker for humans to write, and probably quicker for us to read. 3. JSON can be parsed trivially using the eval() procedure in JavaScript 4. JSON includes arrays {where each element doesn't have a name of its own} 5. In XML you can use any name you want for an element, in JSON you can't use reserved words from javascript
  • 14. JSON in JavaScript •  JSON is a subset of the object literal notation of JavaScript. Since JSON is a subset of JavaScript, it can be used in the language with no muss or fuss. •  var myJSONObject = {"bindings": [ {"ircEvent": "PRIVMSG", "method": "newURI", "regex": "^http://.*"}, {"ircEvent": "PRIVMSG", "method": "deleteURI", "regex": "^delete.*"}, {"ircEvent": "PRIVMSG", "method": "randomURI", "regex": "^random.*"} ] }; •  In this example, an object is created containing a single member "bindings", which contains an array containing three objects, each containing "ircEvent", "method", and"regex" members.
  • 15. Accessing JSON in JavaScript • var  myJSONObject  =     {"bindings":  [  {"ircEvent":  "PRIVMSG",     "method":  "newURI",  "regex":  "^h"p://.*"},...]}   •  Members  can  be  retrieved  using  dot  or  subscript     operators.        myJSONObject.bindings[0].method       //  "newURI"   •  To  convert  a  JSON  text  into  an  object,  you  can  use  the     eval()func[on.  eval()  invokes  the  JavaScript  compiler   •  The  text  must  be  wrapped  in  parenthese  to  avoid  tripping on  an  ambiguity  in  JavaScript's  syntax.   var  myObject  =  eval('('  +  myJSONtext  +  ')');  
  • 16. Objects as Data <html> <body> <script type="text/javascript"> var myFirstJSON = {"firstName" : "Tata", "lastName" : "Saikaew", "age" : 3}; document.writeln(myFirstJSON.firstName); document.writeln(myFirstJSON.lastName); document.writeln(myFirstJSON.age); </script> </body> </html>
  • 17. Nested Objects <html> <body> <script type="text/javascript"> var employees = { "accountings" : [ // accounting is an array in employees {"firstName" : "Tata", "lastName" : "Saikaew", "age" : 30}, {"firstName" : "Teetee", "lastName" : "Wongkaew", "age" : 26} ], "sales" : [ // Sales is another array in employees { "firstName" : "Manee", "lastName" : "Jaidee", "age" : 28}, { "firstName" : "Mana", "lastName" : "Deejai", "age" : 32}] }; // End employees document.write(employees.accountings[0].firstName); </script> </body> </html>
  • 18. Simulating An Associated Array <html> <body> <script type="text/javascript"> var myObject = {'color' : 'blue', 'animal' : {'dog' : 'friendly' } }; document.writeln(myObject.animal.dog); document.writeln(myObject['color']); document.writeln(myObject['animal']['dog']); </script> </body> </html>
  • 19. XML File <wclass> <!--My students who took web programming class with me--> <student id="1"> <name>Linda Jones</name> <legacySkill>Access, VB5.0</legacySkill> </student> <student id="2"> <name>Adam Davidson</name> <legacySkill>Cobol, MainFrame</legacySkill> </student> <student id="3"> <name>Charles Boyer</name> <legacySkill>HTML, Photoshop</legacySkill> </student> </wclass>
  • 20. AJAX and XML Code (1/4) <html> <head> <title>AJAX and XML</title> <script language="javascript"> var xhr = false; function GetXmlHttpObject(){ var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; }
  • 21. AJAX and XML Code (2/4) function getPage (url) { xhr = GetXmlHttpObject(); if (!xhr) { alert ('XMLHttp failed to instantiate'); return false; } xhr.onreadystatechange = statusCheck; xhr.open ('GET', url, true); xhr.send (null); }
  • 22. AJAX and XML Code (3/4) function statusCheck() { if (xhr.readyState == 4) { if (xhr.status == 200) { var nodes=xhr.responseXML.getElementsByTagName("student"); j = 1; for (i=0; i<nodes.length; i++) { var student = nodes.item(i); document.getElementById(j++).innerHTML= (i+1) + ". Student name:" + student.firstChild.nextSibling.firstChild.nodeValue + " skill:" + student.lastChild.previousSibling.firstChild.nodeValue; } } else { alert ('The request could not be fulfilled.'); } } } </script>
  • 23. AJAX and XML Code (4/4) </head> <body> <input id=button2 onclick= "getPage ('http:///localhost/~Macbook/json/ webstudents.xml')" type=button value="Get the XML Document" name=button2> <br/> <div id=1></div></p> <div id=2></div></p> <div id=3></div></p> </body> </html>
  • 24. AJAX and XML Code Result
  • 25. JSON File { "wclass": [ {"student": { "@attributes" : {"id" : "1” }, "name": "Linda Jones", "legacySkill": "Access VB 5.0" } }, {"student": { "@attributes" : { "id": "2” }, "name": "Adam Davidson", "legacySkill": "Cobol, MainFrame" } }, {"student": { "@attributes" : { "id": "3” }, "name": "Charles Boyer", "legacySkill": "HTML, XML" } } ] }
  • 26. JSON and JQuery <script type="text/javascript" src="jquery-1.5.js"></script> <script type="text/javascript"> ... function statusCheck() { if (xhr.readyState == 4) { if (xhr.status == 200) { var jsonT = xhr.responseText; var obj = jQuery.parseJSON(jsonT); var wclass = obj.wclass; j = 1; for (i = 0; i < wclass.length; i++) { document.getElementById(j+ +).innerHTML= (i+1) + ". Student name: " + wclass[i].student.name + " skill: " + wclass[i].student.legacySkill + "<br/>”; }}}}
  • 27. JSON and JQuery Result • 
  • 28. Using JSON in the Google Data Protocol •  The feed is represented as a JSON object; each nested element or attribute is represented as a name/value property of the object. •  Attributes are converted to String properties. •  Child elements are converted to Object properties. •  Elements that may appear more than once are converted to Array properties. •  Text values of tags are converted to $t properties#
  • 29. Sample Google Data in JSON { "version": "1.0", "encoding": "UTF-8", "feed": { "xmlns": "http://www.w3.org/2005/Atom", "xmlns$openSearch": "http://a9.com/-/spec/ opensearchrss/1.0/", "xmlns$gd": "http://schemas.google.com/g/2005", "xmlns$gCal": "http://schemas.google.com/gCal/ 2005", "id": {"$t": "..."}, "updated": {"$t": "2006-11-12T21:25:30.000Z"}, "title": { "type": "text", ...
  • 30. Requesting and Using JSON Feeds •  Atom is Google Data's default format. If you don't specify an alt parameter in your request, then you receive an Atom feed •  To request a response in JSON format, use the alt=json parameter. •  For example, to request Google's developer calendar feed in JSON format, send the following query: •  http://www.google.com/calendar/feeds/developercalendar@google.com/public/full?alt=json
  • 31. Getting JSON Feeds in Javascript • To request a response that wraps JSON in a script tag, use the alt=json-in-script parameter and add a callback function by adding the callback=functionName parameter. • http://www.google.com/calendar/feeds/developercalendar@google.com/public/full?alt=json-inscript&callback=myFunction
  • 32. Sample Script to Get JSON Feeds (1/2) <h3>Upcoming Google Developer Events</h3> <div id="agenda"></div> <script> function listEvents(root) { var feed = root.feed; var entries = feed.entry || []; var html = ['<ul>']; for (var i = 0; i < entries.length; ++i) { var entry = entries[i]; var title = entry.title.$t; var start = (entry['gd$when']) ? entry['gd$when'] [0].startTime : ""; html.push('<li>', start, ' ', title, '</li>'); }
  • 33. Sample Script to Get JSON Feeds (2/2) html.push('</ul>'); document.getElementById("agenda").innerHTML = html.join(""); } </script> <script src="http://www.google.com/calendar/feeds/ developer-calendar@google.com/public/full?alt=jsonin-script&callback=listEvents"> </script>
  • 34. Google Data Sample Script Result • 
  • 35. Encoding JSON in PHP (1/3) <?php    '{"fruits":'.json_encode(array("Apple",   "Banana",  "Pear")).'}‘;                   ?>     35
  • 36. Encoding JSON in PHP (2/3) <?php      echo  '{"numbers":'.json_encode(array(4  =>   "four",  8  =>  "eight")).'}’;         ?>     36
  • 37. Encoding JSON in PHP (3/3) <?php    echo  '{"fruits":'.json_encode(array("apples"  =>  true,   "bananas"  =>  null)).'}';   ?>     37
  • 38. Encode Class to JSON in PHP (1/2) <?php   class  User  {          public  $firstname  =  "";          public  $lastname    =  "";          public  $birthdate  =  "";   }   $user  =  new  User();   $user-­‐>firstname  =  "foo";   $user-­‐>lastname    =  "bar";   json_encode($user);   $user-­‐>birthdate  =  new  DateTime();   echo  json_encode($user);   ?>     38
  • 39. Encode Class to JSON in PHP (2/2) <?php   class  User  {          public  $pub  =  "Mister  X.";          protected  $pro  =  "hidden";          private  $priv  =  "hidden  too”;          public  $func;          public  $notUsed;          public  func[on  __construct()  {                  $this-­‐>func  =  func[on()  {                          return  "Foo";                  };          }   }   $user  =  new  User();   //  Returns:  {"pub":"Mister  X.","func":{},"notUsed":null}   echo  json_encode($user);   ?>     39
  • 40. The $option bitmask Without  bitmask   •   echo   json_encode(array("Starsky   &  Hutch",  "123456"));   With  bitmask   •  echo  json_encode(array("Starsky   &  Hutch",  "123456"),   JSON_NUMERIC_CHECK  |   JSON_FORCE_OBJECT);   40
  • 41. Throwing PHP Exception Through JSON <?php   try  {          if  (0  ==  0)  {                  throw  new  Excep[on('Test  error',  123);          }          echo  json_encode(array(                  'result'  =>  'vanilla!',          ));   }  catch  (Excep[on  $e)  {          echo  json_encode(array(                  'error'  =>  array(                          'msg'  =>  $e-­‐>getMessage(),                          'code'  =>  $e-­‐>getCode(),                  ),          ));   }   ?>     41
  • 42. Encoding Data in UTF-8 •  If  the  incoming  string  is  not  under  your   control,  you  can  use  the  uz8_encode  func[on   to  convert  it  into  uz8   <?php                  $payload  =  array("กานดา  รุณนะพงศา  สายแก้ว");                  echo  uz8_encode(json_encode($payload,  JSON_FORCE_OBJECT));   ?>     42
  • 43. Decode JSON in PHP (1/3) <?php   $string  =  '{"foo":  "bar",  "cool":  "a"r"}';   $result  =  json_decode($string);   //  Result:  object(stdClass)#1  (2)  {  ["foo"]=>  string(3)   "bar"  ["cool"]=>  string(4)  "a"r"  }   var_dump($result);   //  Prints  "bar"   echo  $result-­‐>foo;   echo  "<br/>”;   //  Prints  "a"r"   echo  $result-­‐>cool;   ?>     43
  • 44. Decode JSON in PHP (2/3) •  If you want to get an associative array back instead, set the second parameter to true: <?php $string = '{"foo": "bar", "cool": "attr"}'; $result = json_decode($string, true); // Result: array(2) { ["foo"]=> string(3) "bar" ["cool"]=> string(4) "attr" } var_dump($result); // Prints "bar" echo $result['foo']; echo "<br/>"; // Prints "attr" echo $result['cool']; ?> 44
  • 45. Decode JSON in PHP (3/3) •  If  you  expect  a  very  large  nested  JSON   document,  you  can  limit  the  recursion  depth   to  a  certain  level   •  The  func[on  will  return  null  and  stops  parsing   if  the  document  is  deeper  than  the  given   depth   45
  • 46. Decode with Depth Levels Code  and  Output  (Depth  =  2)   <?php   $string  =  '{"foo":  {"bar":  {"cool":   "value"}}}';   $result  =  json_decode($string,  true,  2);   //  Result:  null   var_dump($result);   ?>     Code  and  Output  (Depth  =  4)   <?php $string = '{"foo": {"bar": {"cool": "value"}}}'; $result = json_decode($string, true, 4); // Result: null var_dump($result); ?> 46
  • 47. References •  •  •  •  •  •  •  •  •  •  •  •  Introducing JSON, http://www.json.org/ JSON in JavaScript, http://www.json.org/js.html http://en.wikipedia.org/wiki/JSON http://secretgeek.net/json_3mins.asp http://funkatron.com/site/comments/safely-parsing-json-in-javascript/ http://yuiblog.com/blog/2007/04/10/json-and-browser-security/ http://www.developer.com/lang/jscript/article.php/3596836/Speeding-UpAJAX-with-JSON.htm http://www.devarticles.com/c/a/JavaScript/AJAX-with-JSON/ http://developer.yahoo.com/javascript/json.html http://www.jsonlint.com/ http://nitschinger.at/Handling-JSON-like-a-boss-in-PHP http://stackoverflow.com/questions/12693423/clean-way-to-throw-phpexception-through-jquery-ajax-and-json