Download presentation
Presentation is loading. Please wait.
Published byJoseph Vogel Modified over 6 years ago
3
The JSON agenda 17:00 Welcome to JSON:
What is JSON, and why should I care about JSON? RESTfull webservices and JSON Microservices and …. JSON 18:30 A break from JSON: A JSON sandwich and a cup of JSON 18:50 Yet more JSON: The Watson JSON API JSON and JAVA JSON in DB2 20:00 It’s time to say good bye to JSON.
4
But first: 1) Power up your smartphone !!! 2) Enter kahoot.it in your browser It’s time for quizzzzz.. … it’s Kahoot time !!!!!
5
JSON Publishing functions
JSON support in DB2 for i JSON Publishing functions JSON_ARRAY JSON_ARRAYAGG JSON_OBJECT JSON_OBJECTAGG JSON Query support Predicates: IS JSON JSON_EXISTS Scalar functions: JSON_QUERY() JSON_VALUE() DB2 JSON Store JSON_TABLE() June 2015 November 2016 TBD TBD First DB2 Family member to have JSON_TABLE support (note that Oracle has it already) Why invest in adding JSON into DB2 for i? JSON is very popular SQL Standards body is adopting this into the standard IBM i 7.1, 7.2, & 7.3 IBM i 7.2 & 7.3
6
JSON_TABLE Converts a JSON expression into relational data
JSON-expressions can be: Character or Graphic (use FORMAT JSON) Binary (use FORMAT BSON) JSON path expression lax Structural problems are tolerated Arrays are automatically unnested strict Structural problems result in an error Arrays are not automatically unnested Can leverage HTTP Functions SELECT * FROM JSON_TABLE( <JSON-expression> , <JSON-path-expression> COLUMNS ( <column-definitions> ) <error-option> FORMAT BSON would equate to using the DB2 JSON Store:
7
JSON Object SELECT * FROM
JSON objects are represented using a list of key-value pairs Curly braces { } indicate object start and end Value Pairs are separated by commas Keys and values separated by colons SELECT * FROM json_table('{"first":"John","last":"Doe"}', '$' columns("first" VARCHAR(40), "last" VARCHAR(40))) x;
8
What is JSON Lightweight transporter protocol Any abstract data types
Any complex data Human readable Easy to parse in any environment (IoT) Easy to produce Cross age/culture developer Esperanto Only by simple components: Primitives, arrays and object
9
A humongous number of JSON transactions
Why is JSON A humongous number of JSON transactions New design paradigms – MVC / MVVM Simple to produce in RESTfull services
10
Model View Control? MVC / MVVM
Controller Client Web Server IBMi
11
It is easy to produce
12
But - what is wrong in this picture?
Access the HTTP protocol header Access the URL directly Static binding to SQL table layout Construct the JSON by hand and send it by HTTP
13
What is wrong in this picture
PLUMBING!! Error prone to the output quality ( well formed JSON) Require knowledge of the HTTP protocol Is only accessible from the HTTP protocol Can not be reused, ( called from an other application) Can not be unit tested Hard to extend Hard to debug
14
Why micro services? Run in any environment. JSON in, JSON out.
Easy unit testing Graceful error handling. Can be written in any language Can be reused, called from an other application Don’t rely on HTTP – why not a dataqueue? Easy to debug Easy to extend Require some kind of routing
15
Micro services in node.js
Seneca Is a micro service framework for node.js – Can we make it run on power – let’s try: ssh or call qp2term on your IBMi ( mine is dksrv206) Mkdir /seneca git -c http.sslVerify=false clone cd getting-started Npm install echo "require('seneca')().use('math').listen()" > msTest.js node msTest.js Now try this in your browser:
16
Any language? Yes: you can make microservices with almost all languages: JAVA – with the spring framework node.js – seneca RPG with noxDB / icebreak
17
It’s JSON break time
18
Let’s talk with Watson Watson has an REST api we can utilize. Let’s play
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.