SlideShare ist ein Scribd-Unternehmen logo
1 von 32
#SQLSAT454
SQL Server 2016: JSON native support
Alessandro Alpi
@suxstellino
www.alessandroalpi.net
http://speakerscore.com/SQLJSON
#SQLSAT454
Sponsors
#SQLSAT454
Alessandro Alpi | @suxstellino
•
– Blog ITA: http://blogs.dotnethell.it/suxstellino
– Blog ENG: http://suxstellino.wordpress.com/
– Website: http://www.alessandroalpi.net
•
– www.engageitservices.it
– Team leader (Agile)
•
– Getlatestversion.it
#SQLSAT454
Keep in mind
– CTP 2 (2.4 now)
– CTP 3 (Future)
– Frequent changes
– V1 features
#SQLSAT454
Agenda
– Concepts, why JSON?
– JSON vs XML
– Options
– Features on CTP2 and 3
– How to index it
– Restrictions
#SQLSAT454
JSON – concepts
– JavaScript Object Notation Acronym
– Based on JavaScript, independent at the same time
– Common data types: bool, int, real, string, array | null
– String, not markup
– Sample:
{
“first”: “Alessandro”,
“last”: “Alpi”
“age”: “34”,
“courses”: [
{“code”: “C001”, “name”: “SQL Server Querying”},
{“code”: “C002”, “name”: “Administering SQL Server”},
{“code”: “C003”, “name”: “Troubleshooting SQL Server”},
]
}
#SQLSAT454
JSON – concepts
– Lightweight and simple format
– Data representation
– Readable/Portable/X-platform (it can replace XML)
– Optimal for AJAX/Javascript
– “ for “name” and “values”
– : for “name”:”value”
– Special char represented with escape (r, t, ecc.)
– { } objects (curly braces)
– [ , ] arrays (square brackets)
– [ { }, { } ] arrays of objects
#SQLSAT454
JSON – concepts
– Data exchange formats
– JSON is open, like XML, but no “real” rules (consortium)
– JSON doesn’t need DTD
– JSON doesn’t need extension, it’s not markup
– JSON represents data, XML is for documents
#SQLSAT454
JSON – concepts
– JSON is built-in (some languages syntax)
– Many serializers (like JSON.Net)
– Less resources intensive when (de)serializing
– JSON is “smaller”, quick to transfer
– JSON doesn’t “carry” media (XML CDATA)
#SQLSAT454
DEMO
#SQLSAT454
Native JSON format support
– Supported from the CTP 2 (also In-Memmory OLTP)
– Before 2016, complex and CPU intensive t-sql
– It’s not a data type like XML
– It’s a string (nvarchar, varchar)
– Native parser right after the query execution
– For additional features, please use CONNECT 
#SQLSAT454
JSON Conversions
– nvarchar, varchar, nchar, char -> string
– int, bigint, float, decimal, numeric -> number
– bit -> Boolean (true, false)
– datetime, date, datetime2, time, datetimeoffset -> string
– Uniqueidentifier, money, binary -> string and BASE64 string
– CLR not supported (except some type, like hierarchyid)
#SQLSAT454
Export features
– PATH
o FOR JSON PATH
– AUTO
o FOR JSON AUTO
– ROOT
o FOR JSON AUTO, ROOT('info')
– INCLUDE_NULL_VALUES
o FOR JSON AUTO, INCLUDE_NULL_VALUES
[
{
"Number":"SO43659",
"Date":"2011-05-31T00:00:00"
"AccountNumber":"AW29825",
"Price":59.99,
"Quantity":1
},
{
"Number":"SO43661",
"Date":"2011-06-01T00:00:00“
"AccountNumber":"AW73565“,
"Price":24.99,
"Quantity":3
}
]
SELECT * FROM myTable
FOR JSON AUTO
#SQLSAT454
FOR JSON PATH
– Without FROM: single JSON objects
– With FROM: array of JSONobjects
– Each column is a JSON “property”
– Alias with “.” as separator (for nesting depth)
– Subquery for sub-JSON
#SQLSAT454
FOR JSON AUTO
– Render based on column/tables order
o ONLY with FROM clause
– STRICT Render (cannot be modified)
– Each column is a JSON “property”
– With JOIN, the “left table” is the root, the “right” one is nested
– Subquery
#SQLSAT454
cmd = (queryWithForJson, conn);
conn.Open();
jsonResult = ();
reader = cmd.ExecuteReader();
(!reader.HasRows())
jsonResult.Append( );
{
reader.Read()
{
jsonResult.Append(reader.GetValue(0).ToString());
}
}
Empty JSON
Append rows
#SQLSAT454
DEMO
#SQLSAT454
Import features
– TVF OPENJSON()
o Filter param
o Syntax JS ($.Collection.Property)
o … FROM OPENJSON (@JSalestOrderDetails,
'$.OrdersArray') WITH (definition);
– Load in temp table
– Analyze columns
SELECT * FROM
OPENJSON(@json)
[
{
"Number":"SO43659",
"Date":"2011-05-31T00:00:00"
"AccountNumber":"AW29825",
"Price":59.99,
"Quantity":1
},…]
#SQLSAT454
Import features
– Validation: ISJSON( json_text )
o Important for CHECK CONSTRAINT
o … WHERE (tab.JCol) > 0
– Querying: JSON_VALUE( json_text, path )
o Gets a scalar value from the JSON (can be filtered by path)
o … AND (tab.JCol,' ') = 'C'
#SQLSAT454
Path param syntax
– $ (the whole JSON text)
– $.prop1 (JSON property)
– $[n] (n-th element on the JSON array)
– $.prop1.prop2.array1[n].prop3.array[2].prop4
(complex traversing/navigation)
#SQLSAT454
DEMO
#SQLSAT454
Where?
– Common column table with JSON “extension”
o Example: “log” info
– Output format for services
– X-platform support (lightweight and simple)
– Possible SSIS integration
#SQLSAT454
Worst practices
– Too much key-value-store based table (key + JSON)
o SQL Server is RDBMS, not Key Value Store (like Redis)
– Store too JSON data
o Can be heavy for the CPU (the parser is well optimized, however.. )
– All queries with FOR JSON clause
o JSON is a useful utility, not a rule
o SQL Server is not an application server
#SQLSAT454
Indexing
– It’s just a string
– Indexing in string -> index on varchar, nvarchar
– Full-text (obviously) supported
– JSON_VALUE can be used for a computed column (+ index)
– Computed columns with JSON_VALUE can be:
o In the index key
o In the INCLUDE of the index (leaf)
#SQLSAT454
Indexing – sample
JSON_VALUE
JSON_VALUE
#SQLSAT454
Restrictions FOR JSON clause
– No CLR (except some, like HIERARCHYID)
– No SELECT INTO
– Column aliases always for non-named values
– A table must exist for parsing (FOR JSON AUTO)
#SQLSAT454
DEMO
#SQLSAT454
Conclusions
Reducing the gap with competitors (PostgreSQL)
Optimized integrated parser (avoid CLR custom)
Poor additional t-sql (parameters and built-in functions)
V1 features
Future storage changes? Index structures?
Biz logic -> application, not everything on SQL Server
#SQLSAT454
Resources
FOR JSON PATH: https://msdn.microsoft.com/en-us/library/dn921877.aspx
FOR JSON AUTO: https://msdn.microsoft.com/en-us/library/dn921883.aspx
INCLUDE_NULL_VALUES: https://msdn.microsoft.com/en-
us/library/dn921878.aspx
ROOT: https://msdn.microsoft.com/en-us/library/dn921894.aspx
POST Jovan Popovic:
http://blogs.msdn.com/b/jocapc/archive/2015/05/16/json-support-in-sql-
server-2016.aspx
POST Aaron Bertrand: http://blogs.sqlsentry.com/aaronbertrand/sql-
server-2016-json-support/
JSON Online Viewer: http://jsonviewer.stack.hu/
JSON Online Query Tool: http://www.jsonquerytool.com/
JSON Online Tool: https://www.jsonselect.com/
#SQLSAT454
Q&A
Questions?
#SQLSAT454
Evaluations
 Don’t forget to compile evaluations form here
 http://speakerscore.com/sqlsat454
 This session: http://speakerscore.com/SQLJSON
#SQLSAT454
THANKS!
HTTP://SPEAKERSCORE.COM/SQLJSON
#sqlsat454

Weitere ähnliche Inhalte

Andere mochten auch

Oraciones simples con solucionario (ppt)
Oraciones simples con solucionario (ppt)Oraciones simples con solucionario (ppt)
Oraciones simples con solucionario (ppt)CastilloAguilera
 
PASS Virtual Chapter - SQL Server Continuous Deployment
PASS Virtual Chapter - SQL Server Continuous DeploymentPASS Virtual Chapter - SQL Server Continuous Deployment
PASS Virtual Chapter - SQL Server Continuous DeploymentAlessandro Alpi
 
[ENG] Sql Saturday 355 in Parma - New "SQL Server databases under source cont...
[ENG] Sql Saturday 355 in Parma - New "SQL Server databases under source cont...[ENG] Sql Saturday 355 in Parma - New "SQL Server databases under source cont...
[ENG] Sql Saturday 355 in Parma - New "SQL Server databases under source cont...Alessandro Alpi
 
Educational managment task_2
Educational managment task_2Educational managment task_2
Educational managment task_2alexandersaa2013
 
[ITA] Sql Saturday 355 in Parma - New SQL Server databases under source control
[ITA] Sql Saturday 355 in Parma - New SQL Server databases under source control[ITA] Sql Saturday 355 in Parma - New SQL Server databases under source control
[ITA] Sql Saturday 355 in Parma - New SQL Server databases under source controlAlessandro Alpi
 
Cwit interview
Cwit interviewCwit interview
Cwit interviewakhtarsaad
 
DevOpsHeroes 2016 - Realizzare Continouous Integration con SQL Server e Visua...
DevOpsHeroes 2016 - Realizzare Continouous Integration con SQL Server e Visua...DevOpsHeroes 2016 - Realizzare Continouous Integration con SQL Server e Visua...
DevOpsHeroes 2016 - Realizzare Continouous Integration con SQL Server e Visua...Alessandro Alpi
 
Lietuviai praranda laisvę
Lietuviai praranda laisvęLietuviai praranda laisvę
Lietuviai praranda laisvęErika Bražienė
 
[ITA] SQL Saturday 257 - Put databases under source control
[ITA] SQL Saturday 257 - Put databases under source control[ITA] SQL Saturday 257 - Put databases under source control
[ITA] SQL Saturday 257 - Put databases under source controlAlessandro Alpi
 
Quick intro sul Source Control su SQL Server
Quick intro sul Source Control su SQL ServerQuick intro sul Source Control su SQL Server
Quick intro sul Source Control su SQL ServerAlessandro Alpi
 

Andere mochten auch (15)

Oraciones simples con solucionario (ppt)
Oraciones simples con solucionario (ppt)Oraciones simples con solucionario (ppt)
Oraciones simples con solucionario (ppt)
 
Slide sharing
Slide sharingSlide sharing
Slide sharing
 
Lista 5
Lista 5Lista 5
Lista 5
 
Directing teaching resume 2015
Directing teaching resume 2015Directing teaching resume 2015
Directing teaching resume 2015
 
Gordonas sausio
Gordonas sausioGordonas sausio
Gordonas sausio
 
PASS Virtual Chapter - SQL Server Continuous Deployment
PASS Virtual Chapter - SQL Server Continuous DeploymentPASS Virtual Chapter - SQL Server Continuous Deployment
PASS Virtual Chapter - SQL Server Continuous Deployment
 
[ENG] Sql Saturday 355 in Parma - New "SQL Server databases under source cont...
[ENG] Sql Saturday 355 in Parma - New "SQL Server databases under source cont...[ENG] Sql Saturday 355 in Parma - New "SQL Server databases under source cont...
[ENG] Sql Saturday 355 in Parma - New "SQL Server databases under source cont...
 
Acting In The Digital Age Workshop @UMFF
Acting In The Digital Age Workshop @UMFFActing In The Digital Age Workshop @UMFF
Acting In The Digital Age Workshop @UMFF
 
Educational managment task_2
Educational managment task_2Educational managment task_2
Educational managment task_2
 
[ITA] Sql Saturday 355 in Parma - New SQL Server databases under source control
[ITA] Sql Saturday 355 in Parma - New SQL Server databases under source control[ITA] Sql Saturday 355 in Parma - New SQL Server databases under source control
[ITA] Sql Saturday 355 in Parma - New SQL Server databases under source control
 
Cwit interview
Cwit interviewCwit interview
Cwit interview
 
DevOpsHeroes 2016 - Realizzare Continouous Integration con SQL Server e Visua...
DevOpsHeroes 2016 - Realizzare Continouous Integration con SQL Server e Visua...DevOpsHeroes 2016 - Realizzare Continouous Integration con SQL Server e Visua...
DevOpsHeroes 2016 - Realizzare Continouous Integration con SQL Server e Visua...
 
Lietuviai praranda laisvę
Lietuviai praranda laisvęLietuviai praranda laisvę
Lietuviai praranda laisvę
 
[ITA] SQL Saturday 257 - Put databases under source control
[ITA] SQL Saturday 257 - Put databases under source control[ITA] SQL Saturday 257 - Put databases under source control
[ITA] SQL Saturday 257 - Put databases under source control
 
Quick intro sul Source Control su SQL Server
Quick intro sul Source Control su SQL ServerQuick intro sul Source Control su SQL Server
Quick intro sul Source Control su SQL Server
 

Ähnlich wie [Eng] Sql Saturday TorinoExpo - Sql Server 2016 JSON support

Persistent Data Structures - partial::Conf
Persistent Data Structures - partial::ConfPersistent Data Structures - partial::Conf
Persistent Data Structures - partial::ConfIvan Vergiliev
 
Postgres vs Mongo / Олег Бартунов (Postgres Professional)
Postgres vs Mongo / Олег Бартунов (Postgres Professional)Postgres vs Mongo / Олег Бартунов (Postgres Professional)
Postgres vs Mongo / Олег Бартунов (Postgres Professional)Ontico
 
Singpore Oracle Sessions III - What is truly useful in Oracle Database 12c fo...
Singpore Oracle Sessions III - What is truly useful in Oracle Database 12c fo...Singpore Oracle Sessions III - What is truly useful in Oracle Database 12c fo...
Singpore Oracle Sessions III - What is truly useful in Oracle Database 12c fo...Lucas Jellema
 
The Pushdown of Everything by Stephan Kessler and Santiago Mola
The Pushdown of Everything by Stephan Kessler and Santiago MolaThe Pushdown of Everything by Stephan Kessler and Santiago Mola
The Pushdown of Everything by Stephan Kessler and Santiago MolaSpark Summit
 
JDD 2016 - Tomasz Borek - DB for next project? Why, Postgres, of course
JDD 2016 - Tomasz Borek - DB for next project? Why, Postgres, of course JDD 2016 - Tomasz Borek - DB for next project? Why, Postgres, of course
JDD 2016 - Tomasz Borek - DB for next project? Why, Postgres, of course PROIDEA
 
Analyze one year of radio station songs aired with Spark SQL, Spotify, and Da...
Analyze one year of radio station songs aired with Spark SQL, Spotify, and Da...Analyze one year of radio station songs aired with Spark SQL, Spotify, and Da...
Analyze one year of radio station songs aired with Spark SQL, Spotify, and Da...Paul Leclercq
 
MYSQL Query Anti-Patterns That Can Be Moved to Sphinx
MYSQL Query Anti-Patterns That Can Be Moved to SphinxMYSQL Query Anti-Patterns That Can Be Moved to Sphinx
MYSQL Query Anti-Patterns That Can Be Moved to SphinxPythian
 
Spark Machine Learning: Adding Your Own Algorithms and Tools with Holden Kara...
Spark Machine Learning: Adding Your Own Algorithms and Tools with Holden Kara...Spark Machine Learning: Adding Your Own Algorithms and Tools with Holden Kara...
Spark Machine Learning: Adding Your Own Algorithms and Tools with Holden Kara...Databricks
 
Apache Spark Performance Troubleshooting at Scale, Challenges, Tools, and Met...
Apache Spark Performance Troubleshooting at Scale, Challenges, Tools, and Met...Apache Spark Performance Troubleshooting at Scale, Challenges, Tools, and Met...
Apache Spark Performance Troubleshooting at Scale, Challenges, Tools, and Met...Databricks
 
Introduction to Spark Datasets - Functional and relational together at last
Introduction to Spark Datasets - Functional and relational together at lastIntroduction to Spark Datasets - Functional and relational together at last
Introduction to Spark Datasets - Functional and relational together at lastHolden Karau
 
Introduction to PostgreSQL
Introduction to PostgreSQLIntroduction to PostgreSQL
Introduction to PostgreSQLJim Mlodgenski
 
Optimizer percona live_ams2015
Optimizer percona live_ams2015Optimizer percona live_ams2015
Optimizer percona live_ams2015Manyi Lu
 
Search and nosql for information management @nosqlmatters Cologne
Search and nosql for information management @nosqlmatters CologneSearch and nosql for information management @nosqlmatters Cologne
Search and nosql for information management @nosqlmatters CologneLucian Precup
 
Alternatives of JPA/Hibernate
Alternatives of JPA/HibernateAlternatives of JPA/Hibernate
Alternatives of JPA/HibernateSunghyouk Bae
 
PostgreSQL 9.4, 9.5 and Beyond @ COSCUP 2015 Taipei
PostgreSQL 9.4, 9.5 and Beyond @ COSCUP 2015 TaipeiPostgreSQL 9.4, 9.5 and Beyond @ COSCUP 2015 Taipei
PostgreSQL 9.4, 9.5 and Beyond @ COSCUP 2015 TaipeiSatoshi Nagayasu
 
Writing Continuous Applications with Structured Streaming PySpark API
Writing Continuous Applications with Structured Streaming PySpark APIWriting Continuous Applications with Structured Streaming PySpark API
Writing Continuous Applications with Structured Streaming PySpark APIDatabricks
 
Proposals for new function in Java SE 9 and beyond
Proposals for new function in Java SE 9 and beyondProposals for new function in Java SE 9 and beyond
Proposals for new function in Java SE 9 and beyondBarry Feigenbaum
 
JSON in 18c and 19c
JSON in 18c and 19cJSON in 18c and 19c
JSON in 18c and 19cstewashton
 
JSON in Oracle 18c and 19c
JSON in Oracle 18c and 19cJSON in Oracle 18c and 19c
JSON in Oracle 18c and 19cstewashton
 
Cassandra Java APIs Old and New – A Comparison
Cassandra Java APIs Old and New – A ComparisonCassandra Java APIs Old and New – A Comparison
Cassandra Java APIs Old and New – A Comparisonshsedghi
 

Ähnlich wie [Eng] Sql Saturday TorinoExpo - Sql Server 2016 JSON support (20)

Persistent Data Structures - partial::Conf
Persistent Data Structures - partial::ConfPersistent Data Structures - partial::Conf
Persistent Data Structures - partial::Conf
 
Postgres vs Mongo / Олег Бартунов (Postgres Professional)
Postgres vs Mongo / Олег Бартунов (Postgres Professional)Postgres vs Mongo / Олег Бартунов (Postgres Professional)
Postgres vs Mongo / Олег Бартунов (Postgres Professional)
 
Singpore Oracle Sessions III - What is truly useful in Oracle Database 12c fo...
Singpore Oracle Sessions III - What is truly useful in Oracle Database 12c fo...Singpore Oracle Sessions III - What is truly useful in Oracle Database 12c fo...
Singpore Oracle Sessions III - What is truly useful in Oracle Database 12c fo...
 
The Pushdown of Everything by Stephan Kessler and Santiago Mola
The Pushdown of Everything by Stephan Kessler and Santiago MolaThe Pushdown of Everything by Stephan Kessler and Santiago Mola
The Pushdown of Everything by Stephan Kessler and Santiago Mola
 
JDD 2016 - Tomasz Borek - DB for next project? Why, Postgres, of course
JDD 2016 - Tomasz Borek - DB for next project? Why, Postgres, of course JDD 2016 - Tomasz Borek - DB for next project? Why, Postgres, of course
JDD 2016 - Tomasz Borek - DB for next project? Why, Postgres, of course
 
Analyze one year of radio station songs aired with Spark SQL, Spotify, and Da...
Analyze one year of radio station songs aired with Spark SQL, Spotify, and Da...Analyze one year of radio station songs aired with Spark SQL, Spotify, and Da...
Analyze one year of radio station songs aired with Spark SQL, Spotify, and Da...
 
MYSQL Query Anti-Patterns That Can Be Moved to Sphinx
MYSQL Query Anti-Patterns That Can Be Moved to SphinxMYSQL Query Anti-Patterns That Can Be Moved to Sphinx
MYSQL Query Anti-Patterns That Can Be Moved to Sphinx
 
Spark Machine Learning: Adding Your Own Algorithms and Tools with Holden Kara...
Spark Machine Learning: Adding Your Own Algorithms and Tools with Holden Kara...Spark Machine Learning: Adding Your Own Algorithms and Tools with Holden Kara...
Spark Machine Learning: Adding Your Own Algorithms and Tools with Holden Kara...
 
Apache Spark Performance Troubleshooting at Scale, Challenges, Tools, and Met...
Apache Spark Performance Troubleshooting at Scale, Challenges, Tools, and Met...Apache Spark Performance Troubleshooting at Scale, Challenges, Tools, and Met...
Apache Spark Performance Troubleshooting at Scale, Challenges, Tools, and Met...
 
Introduction to Spark Datasets - Functional and relational together at last
Introduction to Spark Datasets - Functional and relational together at lastIntroduction to Spark Datasets - Functional and relational together at last
Introduction to Spark Datasets - Functional and relational together at last
 
Introduction to PostgreSQL
Introduction to PostgreSQLIntroduction to PostgreSQL
Introduction to PostgreSQL
 
Optimizer percona live_ams2015
Optimizer percona live_ams2015Optimizer percona live_ams2015
Optimizer percona live_ams2015
 
Search and nosql for information management @nosqlmatters Cologne
Search and nosql for information management @nosqlmatters CologneSearch and nosql for information management @nosqlmatters Cologne
Search and nosql for information management @nosqlmatters Cologne
 
Alternatives of JPA/Hibernate
Alternatives of JPA/HibernateAlternatives of JPA/Hibernate
Alternatives of JPA/Hibernate
 
PostgreSQL 9.4, 9.5 and Beyond @ COSCUP 2015 Taipei
PostgreSQL 9.4, 9.5 and Beyond @ COSCUP 2015 TaipeiPostgreSQL 9.4, 9.5 and Beyond @ COSCUP 2015 Taipei
PostgreSQL 9.4, 9.5 and Beyond @ COSCUP 2015 Taipei
 
Writing Continuous Applications with Structured Streaming PySpark API
Writing Continuous Applications with Structured Streaming PySpark APIWriting Continuous Applications with Structured Streaming PySpark API
Writing Continuous Applications with Structured Streaming PySpark API
 
Proposals for new function in Java SE 9 and beyond
Proposals for new function in Java SE 9 and beyondProposals for new function in Java SE 9 and beyond
Proposals for new function in Java SE 9 and beyond
 
JSON in 18c and 19c
JSON in 18c and 19cJSON in 18c and 19c
JSON in 18c and 19c
 
JSON in Oracle 18c and 19c
JSON in Oracle 18c and 19cJSON in Oracle 18c and 19c
JSON in Oracle 18c and 19c
 
Cassandra Java APIs Old and New – A Comparison
Cassandra Java APIs Old and New – A ComparisonCassandra Java APIs Old and New – A Comparison
Cassandra Java APIs Old and New – A Comparison
 

Mehr von Alessandro Alpi

Mvp4 croatia - Being a dba in a devops world
Mvp4 croatia - Being a dba in a devops worldMvp4 croatia - Being a dba in a devops world
Mvp4 croatia - Being a dba in a devops worldAlessandro Alpi
 
Digital warriors 2020 - Smart?
Digital warriors 2020 - Smart?Digital warriors 2020 - Smart?
Digital warriors 2020 - Smart?Alessandro Alpi
 
Sql Wars - SQL the attack of the Clones and the rebellion of the Containers
Sql Wars - SQL the attack of the Clones and the rebellion of the Containers Sql Wars - SQL the attack of the Clones and the rebellion of the Containers
Sql Wars - SQL the attack of the Clones and the rebellion of the Containers Alessandro Alpi
 
Sql Wars - SQL Clone vs Docker Containers
Sql Wars - SQL Clone vs Docker Containers Sql Wars - SQL Clone vs Docker Containers
Sql Wars - SQL Clone vs Docker Containers Alessandro Alpi
 
Doaw2020 - Dalla produzione alla QA, provisioning su SQL Server
Doaw2020 - Dalla produzione alla QA, provisioning su SQL ServerDoaw2020 - Dalla produzione alla QA, provisioning su SQL Server
Doaw2020 - Dalla produzione alla QA, provisioning su SQL ServerAlessandro Alpi
 
Wpc2019 - Distruggere DevOps, la storia di un vero team
Wpc2019 - Distruggere DevOps, la storia di un vero teamWpc2019 - Distruggere DevOps, la storia di un vero team
Wpc2019 - Distruggere DevOps, la storia di un vero teamAlessandro Alpi
 
Sql start!2019 Migliorare la produttività per lo sviluppo su SQL Server
Sql start!2019 Migliorare la produttività per lo sviluppo su SQL ServerSql start!2019 Migliorare la produttività per lo sviluppo su SQL Server
Sql start!2019 Migliorare la produttività per lo sviluppo su SQL ServerAlessandro Alpi
 
Configuration e change management con Disciplined Agile Framework
Configuration e change management con Disciplined Agile FrameworkConfiguration e change management con Disciplined Agile Framework
Configuration e change management con Disciplined Agile FrameworkAlessandro Alpi
 
Basta poco per distruggere DevOps
Basta poco per distruggere DevOpsBasta poco per distruggere DevOps
Basta poco per distruggere DevOpsAlessandro Alpi
 
Automatizzare il processo di link dei database con redgate source control
Automatizzare il processo di link dei database con redgate source controlAutomatizzare il processo di link dei database con redgate source control
Automatizzare il processo di link dei database con redgate source controlAlessandro Alpi
 
Sql saturday parma 2017 (#sqlsat675) - Deep space Cosmos DB
Sql saturday parma 2017 (#sqlsat675) - Deep space Cosmos DBSql saturday parma 2017 (#sqlsat675) - Deep space Cosmos DB
Sql saturday parma 2017 (#sqlsat675) - Deep space Cosmos DBAlessandro Alpi
 
Sql Saturday a Pordenone - Sql Server journey, da dev a ops
Sql Saturday a Pordenone - Sql Server journey, da dev a opsSql Saturday a Pordenone - Sql Server journey, da dev a ops
Sql Saturday a Pordenone - Sql Server journey, da dev a opsAlessandro Alpi
 
PASS Virtual Chapter - Unit Testing su SQL Server
PASS Virtual Chapter - Unit Testing su SQL ServerPASS Virtual Chapter - Unit Testing su SQL Server
PASS Virtual Chapter - Unit Testing su SQL ServerAlessandro Alpi
 
[Ita] Sql Saturday 462 Parma - Sql Server 2016 JSON support
[Ita] Sql Saturday 462 Parma - Sql Server 2016 JSON support[Ita] Sql Saturday 462 Parma - Sql Server 2016 JSON support
[Ita] Sql Saturday 462 Parma - Sql Server 2016 JSON supportAlessandro Alpi
 

Mehr von Alessandro Alpi (14)

Mvp4 croatia - Being a dba in a devops world
Mvp4 croatia - Being a dba in a devops worldMvp4 croatia - Being a dba in a devops world
Mvp4 croatia - Being a dba in a devops world
 
Digital warriors 2020 - Smart?
Digital warriors 2020 - Smart?Digital warriors 2020 - Smart?
Digital warriors 2020 - Smart?
 
Sql Wars - SQL the attack of the Clones and the rebellion of the Containers
Sql Wars - SQL the attack of the Clones and the rebellion of the Containers Sql Wars - SQL the attack of the Clones and the rebellion of the Containers
Sql Wars - SQL the attack of the Clones and the rebellion of the Containers
 
Sql Wars - SQL Clone vs Docker Containers
Sql Wars - SQL Clone vs Docker Containers Sql Wars - SQL Clone vs Docker Containers
Sql Wars - SQL Clone vs Docker Containers
 
Doaw2020 - Dalla produzione alla QA, provisioning su SQL Server
Doaw2020 - Dalla produzione alla QA, provisioning su SQL ServerDoaw2020 - Dalla produzione alla QA, provisioning su SQL Server
Doaw2020 - Dalla produzione alla QA, provisioning su SQL Server
 
Wpc2019 - Distruggere DevOps, la storia di un vero team
Wpc2019 - Distruggere DevOps, la storia di un vero teamWpc2019 - Distruggere DevOps, la storia di un vero team
Wpc2019 - Distruggere DevOps, la storia di un vero team
 
Sql start!2019 Migliorare la produttività per lo sviluppo su SQL Server
Sql start!2019 Migliorare la produttività per lo sviluppo su SQL ServerSql start!2019 Migliorare la produttività per lo sviluppo su SQL Server
Sql start!2019 Migliorare la produttività per lo sviluppo su SQL Server
 
Configuration e change management con Disciplined Agile Framework
Configuration e change management con Disciplined Agile FrameworkConfiguration e change management con Disciplined Agile Framework
Configuration e change management con Disciplined Agile Framework
 
Basta poco per distruggere DevOps
Basta poco per distruggere DevOpsBasta poco per distruggere DevOps
Basta poco per distruggere DevOps
 
Automatizzare il processo di link dei database con redgate source control
Automatizzare il processo di link dei database con redgate source controlAutomatizzare il processo di link dei database con redgate source control
Automatizzare il processo di link dei database con redgate source control
 
Sql saturday parma 2017 (#sqlsat675) - Deep space Cosmos DB
Sql saturday parma 2017 (#sqlsat675) - Deep space Cosmos DBSql saturday parma 2017 (#sqlsat675) - Deep space Cosmos DB
Sql saturday parma 2017 (#sqlsat675) - Deep space Cosmos DB
 
Sql Saturday a Pordenone - Sql Server journey, da dev a ops
Sql Saturday a Pordenone - Sql Server journey, da dev a opsSql Saturday a Pordenone - Sql Server journey, da dev a ops
Sql Saturday a Pordenone - Sql Server journey, da dev a ops
 
PASS Virtual Chapter - Unit Testing su SQL Server
PASS Virtual Chapter - Unit Testing su SQL ServerPASS Virtual Chapter - Unit Testing su SQL Server
PASS Virtual Chapter - Unit Testing su SQL Server
 
[Ita] Sql Saturday 462 Parma - Sql Server 2016 JSON support
[Ita] Sql Saturday 462 Parma - Sql Server 2016 JSON support[Ita] Sql Saturday 462 Parma - Sql Server 2016 JSON support
[Ita] Sql Saturday 462 Parma - Sql Server 2016 JSON support
 

Kürzlich hochgeladen

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)Samir Dash
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 

Kürzlich hochgeladen (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

[Eng] Sql Saturday TorinoExpo - Sql Server 2016 JSON support

  • 1. #SQLSAT454 SQL Server 2016: JSON native support Alessandro Alpi @suxstellino www.alessandroalpi.net http://speakerscore.com/SQLJSON
  • 3. #SQLSAT454 Alessandro Alpi | @suxstellino • – Blog ITA: http://blogs.dotnethell.it/suxstellino – Blog ENG: http://suxstellino.wordpress.com/ – Website: http://www.alessandroalpi.net • – www.engageitservices.it – Team leader (Agile) • – Getlatestversion.it
  • 4. #SQLSAT454 Keep in mind – CTP 2 (2.4 now) – CTP 3 (Future) – Frequent changes – V1 features
  • 5. #SQLSAT454 Agenda – Concepts, why JSON? – JSON vs XML – Options – Features on CTP2 and 3 – How to index it – Restrictions
  • 6. #SQLSAT454 JSON – concepts – JavaScript Object Notation Acronym – Based on JavaScript, independent at the same time – Common data types: bool, int, real, string, array | null – String, not markup – Sample: { “first”: “Alessandro”, “last”: “Alpi” “age”: “34”, “courses”: [ {“code”: “C001”, “name”: “SQL Server Querying”}, {“code”: “C002”, “name”: “Administering SQL Server”}, {“code”: “C003”, “name”: “Troubleshooting SQL Server”}, ] }
  • 7. #SQLSAT454 JSON – concepts – Lightweight and simple format – Data representation – Readable/Portable/X-platform (it can replace XML) – Optimal for AJAX/Javascript – “ for “name” and “values” – : for “name”:”value” – Special char represented with escape (r, t, ecc.) – { } objects (curly braces) – [ , ] arrays (square brackets) – [ { }, { } ] arrays of objects
  • 8. #SQLSAT454 JSON – concepts – Data exchange formats – JSON is open, like XML, but no “real” rules (consortium) – JSON doesn’t need DTD – JSON doesn’t need extension, it’s not markup – JSON represents data, XML is for documents
  • 9. #SQLSAT454 JSON – concepts – JSON is built-in (some languages syntax) – Many serializers (like JSON.Net) – Less resources intensive when (de)serializing – JSON is “smaller”, quick to transfer – JSON doesn’t “carry” media (XML CDATA)
  • 11. #SQLSAT454 Native JSON format support – Supported from the CTP 2 (also In-Memmory OLTP) – Before 2016, complex and CPU intensive t-sql – It’s not a data type like XML – It’s a string (nvarchar, varchar) – Native parser right after the query execution – For additional features, please use CONNECT 
  • 12. #SQLSAT454 JSON Conversions – nvarchar, varchar, nchar, char -> string – int, bigint, float, decimal, numeric -> number – bit -> Boolean (true, false) – datetime, date, datetime2, time, datetimeoffset -> string – Uniqueidentifier, money, binary -> string and BASE64 string – CLR not supported (except some type, like hierarchyid)
  • 13. #SQLSAT454 Export features – PATH o FOR JSON PATH – AUTO o FOR JSON AUTO – ROOT o FOR JSON AUTO, ROOT('info') – INCLUDE_NULL_VALUES o FOR JSON AUTO, INCLUDE_NULL_VALUES [ { "Number":"SO43659", "Date":"2011-05-31T00:00:00" "AccountNumber":"AW29825", "Price":59.99, "Quantity":1 }, { "Number":"SO43661", "Date":"2011-06-01T00:00:00“ "AccountNumber":"AW73565“, "Price":24.99, "Quantity":3 } ] SELECT * FROM myTable FOR JSON AUTO
  • 14. #SQLSAT454 FOR JSON PATH – Without FROM: single JSON objects – With FROM: array of JSONobjects – Each column is a JSON “property” – Alias with “.” as separator (for nesting depth) – Subquery for sub-JSON
  • 15. #SQLSAT454 FOR JSON AUTO – Render based on column/tables order o ONLY with FROM clause – STRICT Render (cannot be modified) – Each column is a JSON “property” – With JOIN, the “left table” is the root, the “right” one is nested – Subquery
  • 16. #SQLSAT454 cmd = (queryWithForJson, conn); conn.Open(); jsonResult = (); reader = cmd.ExecuteReader(); (!reader.HasRows()) jsonResult.Append( ); { reader.Read() { jsonResult.Append(reader.GetValue(0).ToString()); } } Empty JSON Append rows
  • 18. #SQLSAT454 Import features – TVF OPENJSON() o Filter param o Syntax JS ($.Collection.Property) o … FROM OPENJSON (@JSalestOrderDetails, '$.OrdersArray') WITH (definition); – Load in temp table – Analyze columns SELECT * FROM OPENJSON(@json) [ { "Number":"SO43659", "Date":"2011-05-31T00:00:00" "AccountNumber":"AW29825", "Price":59.99, "Quantity":1 },…]
  • 19. #SQLSAT454 Import features – Validation: ISJSON( json_text ) o Important for CHECK CONSTRAINT o … WHERE (tab.JCol) > 0 – Querying: JSON_VALUE( json_text, path ) o Gets a scalar value from the JSON (can be filtered by path) o … AND (tab.JCol,' ') = 'C'
  • 20. #SQLSAT454 Path param syntax – $ (the whole JSON text) – $.prop1 (JSON property) – $[n] (n-th element on the JSON array) – $.prop1.prop2.array1[n].prop3.array[2].prop4 (complex traversing/navigation)
  • 22. #SQLSAT454 Where? – Common column table with JSON “extension” o Example: “log” info – Output format for services – X-platform support (lightweight and simple) – Possible SSIS integration
  • 23. #SQLSAT454 Worst practices – Too much key-value-store based table (key + JSON) o SQL Server is RDBMS, not Key Value Store (like Redis) – Store too JSON data o Can be heavy for the CPU (the parser is well optimized, however.. ) – All queries with FOR JSON clause o JSON is a useful utility, not a rule o SQL Server is not an application server
  • 24. #SQLSAT454 Indexing – It’s just a string – Indexing in string -> index on varchar, nvarchar – Full-text (obviously) supported – JSON_VALUE can be used for a computed column (+ index) – Computed columns with JSON_VALUE can be: o In the index key o In the INCLUDE of the index (leaf)
  • 26. #SQLSAT454 Restrictions FOR JSON clause – No CLR (except some, like HIERARCHYID) – No SELECT INTO – Column aliases always for non-named values – A table must exist for parsing (FOR JSON AUTO)
  • 28. #SQLSAT454 Conclusions Reducing the gap with competitors (PostgreSQL) Optimized integrated parser (avoid CLR custom) Poor additional t-sql (parameters and built-in functions) V1 features Future storage changes? Index structures? Biz logic -> application, not everything on SQL Server
  • 29. #SQLSAT454 Resources FOR JSON PATH: https://msdn.microsoft.com/en-us/library/dn921877.aspx FOR JSON AUTO: https://msdn.microsoft.com/en-us/library/dn921883.aspx INCLUDE_NULL_VALUES: https://msdn.microsoft.com/en- us/library/dn921878.aspx ROOT: https://msdn.microsoft.com/en-us/library/dn921894.aspx POST Jovan Popovic: http://blogs.msdn.com/b/jocapc/archive/2015/05/16/json-support-in-sql- server-2016.aspx POST Aaron Bertrand: http://blogs.sqlsentry.com/aaronbertrand/sql- server-2016-json-support/ JSON Online Viewer: http://jsonviewer.stack.hu/ JSON Online Query Tool: http://www.jsonquerytool.com/ JSON Online Tool: https://www.jsonselect.com/
  • 31. #SQLSAT454 Evaluations  Don’t forget to compile evaluations form here  http://speakerscore.com/sqlsat454  This session: http://speakerscore.com/SQLJSON

Hinweis der Redaktion

  1. Meet Stephen Hall, I have gotten to know Stephen very well in the past several months working on this project.  Stephen started District Computers more than 10 years ago with the customer in mind.  His company specializes in Small Business with a focus on Office365.
  2. JSON è acronimo di JavaScript Object Notation ed è un recente formato di scambio informazioni basato su JavaScript. Tuttavia è indipendente da esso. Recentemente ha avuto sempre più applicazioni in alternativa a XML/XSLT, essendo decisamente più di immediata gestione. La semplicità di JSON ha consentito la sua presenza sempre più preponderante nella programmazione, soprattutto per quello che ha a che fare con AJAX. I tipi di dato supportati sono: bool (true, false), interi, real, stringhe, array (con le []) ed array associativi (array identificati da una stringa usata come nome). JSON è un formato ed è una stringa, non è un linguaggio di markup come invece è XML. Questo sottolinea ancora di più la sua semplicità.
  3. Tra le cose dette fino ad ora, ci sono alcuni validi motivi per i quali utilizzare JSON. Essendo, come dicevamo, una stringa, è semplice. Il suo punto di forza è proprio questa semplicità. Essendo poi sprovvisto di tag, non è verboso, e quindi è leggero. E’ un formato indicato per la rappresentazione di strutture e dati, essendo in aggiunta molto leggibile ed auto documentativo. Queste considerazioni sottolineano quanto JSON sia portabile, e, di conseguenza, interoperabile, andando di fatto a sostituire XML per la comunicazione cross platform. Infatti è uno dei più utilizzati formati di scambio informazioni presenti ad oggi. Come dicevamo prima, è utilizzato soprattutto nel mondo di AJAX e della programmazione in JavaScript con AJAX, appunto.
  4. In questa semplice dimostrazione andremo ad utilizzare questo editor: http://codebeautify.org/xmltojson che consente di mettere a confronto velocemente i due formati.