SlideShare a Scribd company logo
1 of 32
Download to read offline
JSON and
JSON Schema
Support
© 2020 Syncro Soft SRL. All rights reserved.
Octavian Nadolu, Syncro Soft
octavian_nadolu@oxygenxml.com
@OctavianNadolu
JSON Features
Agenda
● JSON and JSON Schema in Oxygen
● Validating JSON with Schematron
● Convert between JSON and XML
● XSD to JSON schema converter
● Instance generator from a JSON Schema
● Generate JSON Schema from JSON instance
JSON Features
JSON
(JavaScript Object Notation)
● Data representation format
● Used for API and Configs
● Lightweight and easy to read/write
http://json.org
JSON Features
JSON Documents Structure
● JSON Data – name/value pair
● JSON Object {...}
● JSON Array [...]
JSON Features
Validating JSON Documents
● Checking Well-Formedness in JSON
Documents
● Validating JSON Documents Against JSON
Schema
● Validating JSON Schema According to the
Specification
JSON Features
Checking Well-Formedness
Check if the JSON document respects the JSON specification
{
"id": "jane.doe",
"firstname": "Jane",
"lastname": "Doe",
"email": "jane@oxygenxml.com",
"age": 37
}
ECMA-404 The JSON Data Interchange Standard
http://json.org/
JSON Features
Example
{
"persons" [
{
"id": "jane.doe",
"firstname": "Jane",
"lastname": "Doe",
"email": "jane@oxygenxml.com"
"age": 37,
},
{
"id": "john.jones,
"firtname": "John",
"lastname": "Jones,
"email": "john@oxygenxml.com",
"age": 42
]
}
Expected ',' character
Unexpected ',' character
Expected a ':' after a key
Expected quotes
Expected '}'
JSON Features
JSON Schema
JSON Schema is a vocabulary that allows you to
annotate and validate JSON documents
http://json-schema.org
JSON Features
Defining JSON Schema
● Similar to XML Schema, RNG, or DTD
● Written in JSON
● Used to define the structure of a JSON data
{”type”: ”string”}
JSON Schema
”I'm a string”
JSON Instance
JSON Features
JSON Schema Definition
● It is recommended to to have the schema definition on the first level
"$schema": "http://json-schema.org/draft-07/schema#"
● JSON Schema used versions:
– Draft 4
– Draft 6
– Draft 7
– Draft 8 (2019-09)
JSON Features
Associate JSON Schema
● Associating a Schema to JSON Documents
– Directly in JSON document – using $schema property
– In application options
{
"$schema": "person-schema.json",
"persons" [ ... ]
}
Absolute or relative URI
JSON Features
Validating JSON Schema
● Check for well-formedness
● Validate accordingly to the Internet Engineering Task Force (IETF)
Specification
JSON Features
Validating JSON with Schematron
● Specify the JSON structure using JSON Schema
● Express co-constraints and define custom rules using Schematron
JSON Features
Schematron for JSON
● Use XPath to express the rules
<sch:rule context="persons">
<sch:assert test="number(age) > preceding-sibling::node()/age ">
The person age must be grater than the previous person age </sch:assert>
</sch:rule>
JSON Features
Editing JSON
● JSON Text and Grid Editing Mode
● JSON Outline View
● Content Completion Assistant in JSON
● Associate JSON Schema to JSON
Documents
JSON Features
Text and Grid Editing Mode
JSON Features
JSON Outline View
● Document Overview
● Synchronization with Editor
● Filtering
● Error Markers
JSON Features
Associate JSON Schema
● Associating a Schema to JSON Documents
– Directly in JSON Documents
– Through a Validation Scenario
JSON Features
Content Completion
● Context-Sensitive
● Valid Proposals
● Documentation from Schema
● Code Templates
JSON Features
Querying and Transforming
● Query using XPath
● Transform JSON using XSLT and XQuery
JSON Features
XPath
● XPath Toolbar and XPath Builder View
● Content Completion
● XPath Over Multiple Files
JSON Features
Transform using XSLT/XQuery
● Transform JSON Documents to Different Formats
● Create XSLT/XQuery Transformation Scenario for JSON
● XQuery Builder view
● Functions to process JSON document:
● json-doc($href as xs:string?) as item()?
● json-to-xml($json-text as xs:string?) as document-node()?
JSON Features
JSON Tools
● Convert between JSON and XML
● XSD to JSON Schema converter
● Instance generator from a JSON Schema
● Generate JSON Schema from JSON
instance
JSON Features
JSON to XML
{
"personnel": {
"person": [
{
"id": 1,
"name": {
"family": "Worker",
"given": "One"
},
"email": "one@oxygenxml.com",
"link": {"manager": "Big.Boss"}
},
{
"id": 2,
"name": {
"family": "Worker",
"given": "Two"
},
"email": "two@oxygenxml.com",
"link": {"manager": "Big.Boss"}
}
]
}
}
<personnel>
<person>
<id>1</id>
<name>
<family>Worker</family>
<given>One</given>
</name>
<email>one@oxygenxml.com</email>
<link>
<manager>Big.Boss</manager>
</link>
</person>
<person>
<id>2</id>
<name>
<family>Worker</family>
<given>Two</given>
</name>
<email>two@oxygenxml.com</email>
<link>
<manager>Big.Boss</manager>
</link>
</person>
</personnel>
JSON Features
JSON to XML Conversion Details
● A <JSON> element is added as root if the converted JSON has multiple
properties on the first level
● An <array> element is added as root if the converted JSON is an array
[
{"name": "Boss"},
{"name": "Worker"}
]
<array>
<array>
<name>Boss</name>
</array>
<array>
<name>Worker</name>
</array>
</array>
{
"person": "one",
"id": "personnel-id"
}
<JSON>
<person>one</person>
<id>personnel-id</id>
</JSON>
oxygenxml.com/doc/ug-editor/topics/convert-JSON-to-XML-x-tools.html
JSON Features
1
XML to JSON
<personnel>
<person id="1">
<name>
<family>Worker</family>
<given>One</given>
</name>
<email>one@oxygenxml.com</email>
<link manager="harris.anderson"/>
</person>
<person>
<id>2</id>
<name>
<family>Worker</family>
<given>Two</given>
</name>
<email>two@oxygenxml.com</email>
<link manager="harris.anderson"/>
</person>
</personnel>
{
"personnel": {
"person": [
{
"id": 1,
"name": {
"family": "Worker",
"given": "One"
},
"email": "one@oxygenxml.com",
"link": {"manager": "harris.anderson"}
},
{
"id": 2,
"name": {
"family": "Worker",
"given": "Two"
},
"email": "two@oxygenxml.com",
"link": {"manager": "harris.anderson"}
}
]
}
}
JSON Features
XML to JSON Conversion Details
● XML attributes are converted to properties
<person id="1"/> {"person": {"id": 1}}
● Multiple elements with the same name are converted into an array
<person>One</person> "person": ["One","Two"]
<person>Two</person>
● Text in mixed content will be converted in a #text property
<p>This is an <b>example</b>!</p> p": {"#text": "This is an",
"b": "example",
"#text1": "!"}
oxygenxml.com/doc/ug-editor/topics/convert-XML-to-JSON-x-tools.html
JSON Features
XSD to JSON Schema converter
● Tool for converting an XML Schema file (XSD) to a JSON Schema
oxygenxml.com/doc/ug-editor/topics/xsd-to-json-schema-converter-x.html
JSON Features
Instance generator from a JSON Schema
● Tool for generating sample JSON files from a JSON Schema
oxygenxml.com/doc/ug-editor/topics/json-schema-instance-generator.html
JSON Features
Generate JSON Schema from JSON instance
● Tool for generating JSON Schema
oxygenxml.com/doc/ug-editor/topics/json-schema-instance-generator.html
JSON Features
Conclusion
● JSON conforms to ECMA/ISO specification
● Validate JSON with JSON Schema and Schematron
● Editing based on JSON Schema
● Query and process JSON using XPath, XSLT/XQuery
● Useful JSON Tools
Questions?
Octavian Nadolu
Software Architect at Syncro Soft
octavian.nadolu@oxygenxml.com
Twitter: @OctavianNadolu
LinkedIn: octaviannadolu

More Related Content

What's hot

JavaScript Object Notation (JSON)
JavaScript Object Notation (JSON)JavaScript Object Notation (JSON)
JavaScript Object Notation (JSON)BOSS Webtech
 
JSON: The Basics
JSON: The BasicsJSON: The Basics
JSON: The BasicsJeff Fox
 
MongoDB Schema Design
MongoDB Schema DesignMongoDB Schema Design
MongoDB Schema DesignMongoDB
 
Building your first app with mongo db
Building your first app with mongo dbBuilding your first app with mongo db
Building your first app with mongo dbMongoDB
 
Devoxx - JSON Validation using JSON Schema and Jackson
Devoxx - JSON Validation using JSON Schema and JacksonDevoxx - JSON Validation using JSON Schema and Jackson
Devoxx - JSON Validation using JSON Schema and Jacksonsrondal
 
The Fine Art of Schema Design in MongoDB: Dos and Don'ts
The Fine Art of Schema Design in MongoDB: Dos and Don'tsThe Fine Art of Schema Design in MongoDB: Dos and Don'ts
The Fine Art of Schema Design in MongoDB: Dos and Don'tsMatias Cascallares
 
Building a Location-based platform with MongoDB from Zero.
Building a Location-based platform with MongoDB from Zero.Building a Location-based platform with MongoDB from Zero.
Building a Location-based platform with MongoDB from Zero.Ravi Teja
 
JSON-LD update DC 2017
JSON-LD update DC 2017JSON-LD update DC 2017
JSON-LD update DC 2017Gregg Kellogg
 
Learn Learn how to build your mobile back-end with MongoDB
Learn Learn how to build your mobile back-end with MongoDBLearn Learn how to build your mobile back-end with MongoDB
Learn Learn how to build your mobile back-end with MongoDBMarakana Inc.
 
Building Apps with MongoDB
Building Apps with MongoDBBuilding Apps with MongoDB
Building Apps with MongoDBNate Abele
 
Schema Design with MongoDB
Schema Design with MongoDBSchema Design with MongoDB
Schema Design with MongoDBrogerbodamer
 

What's hot (20)

Json
JsonJson
Json
 
JSON
JSONJSON
JSON
 
JSON
JSONJSON
JSON
 
JavaScript Object Notation (JSON)
JavaScript Object Notation (JSON)JavaScript Object Notation (JSON)
JavaScript Object Notation (JSON)
 
JSON: The Basics
JSON: The BasicsJSON: The Basics
JSON: The Basics
 
Advanced Json
Advanced JsonAdvanced Json
Advanced Json
 
Json Tutorial
Json TutorialJson Tutorial
Json Tutorial
 
SCIM and VOOT
SCIM and VOOTSCIM and VOOT
SCIM and VOOT
 
MongoDB Schema Design
MongoDB Schema DesignMongoDB Schema Design
MongoDB Schema Design
 
Json
JsonJson
Json
 
Building your first app with mongo db
Building your first app with mongo dbBuilding your first app with mongo db
Building your first app with mongo db
 
Devoxx - JSON Validation using JSON Schema and Jackson
Devoxx - JSON Validation using JSON Schema and JacksonDevoxx - JSON Validation using JSON Schema and Jackson
Devoxx - JSON Validation using JSON Schema and Jackson
 
Nosql
NosqlNosql
Nosql
 
The Fine Art of Schema Design in MongoDB: Dos and Don'ts
The Fine Art of Schema Design in MongoDB: Dos and Don'tsThe Fine Art of Schema Design in MongoDB: Dos and Don'ts
The Fine Art of Schema Design in MongoDB: Dos and Don'ts
 
Building a Location-based platform with MongoDB from Zero.
Building a Location-based platform with MongoDB from Zero.Building a Location-based platform with MongoDB from Zero.
Building a Location-based platform with MongoDB from Zero.
 
JSON-LD update DC 2017
JSON-LD update DC 2017JSON-LD update DC 2017
JSON-LD update DC 2017
 
Learn Learn how to build your mobile back-end with MongoDB
Learn Learn how to build your mobile back-end with MongoDBLearn Learn how to build your mobile back-end with MongoDB
Learn Learn how to build your mobile back-end with MongoDB
 
Building Apps with MongoDB
Building Apps with MongoDBBuilding Apps with MongoDB
Building Apps with MongoDB
 
Schema Design with MongoDB
Schema Design with MongoDBSchema Design with MongoDB
Schema Design with MongoDB
 
An introduction to MongoDB
An introduction to MongoDBAn introduction to MongoDB
An introduction to MongoDB
 

Similar to JSON and JSON Schema in Oxygen

Similar to JSON and JSON Schema in Oxygen (20)

Hands on JSON
Hands on JSONHands on JSON
Hands on JSON
 
LF_APIStrat17_Embracing JSON Schema
LF_APIStrat17_Embracing JSON SchemaLF_APIStrat17_Embracing JSON Schema
LF_APIStrat17_Embracing JSON Schema
 
Create an Design JSON Schema
Create an Design JSON SchemaCreate an Design JSON Schema
Create an Design JSON Schema
 
Json tutorial, a beguiner guide
Json tutorial, a beguiner guideJson tutorial, a beguiner guide
Json tutorial, a beguiner guide
 
Json at work overview and ecosystem-v2.0
Json at work   overview and ecosystem-v2.0Json at work   overview and ecosystem-v2.0
Json at work overview and ecosystem-v2.0
 
Pythonlearn-13-WebServices.pptx
Pythonlearn-13-WebServices.pptxPythonlearn-13-WebServices.pptx
Pythonlearn-13-WebServices.pptx
 
JSON-(JavaScript Object Notation)
JSON-(JavaScript Object Notation)JSON-(JavaScript Object Notation)
JSON-(JavaScript Object Notation)
 
Webscale PostgreSQL - JSONB and Horizontal Scaling Strategies
Webscale PostgreSQL - JSONB and Horizontal Scaling StrategiesWebscale PostgreSQL - JSONB and Horizontal Scaling Strategies
Webscale PostgreSQL - JSONB and Horizontal Scaling Strategies
 
Json
JsonJson
Json
 
Json
JsonJson
Json
 
Mule: JSON to Object
Mule: JSON to ObjectMule: JSON to Object
Mule: JSON to Object
 
Json
JsonJson
Json
 
Schematron For Non-XML Languages
Schematron For Non-XML LanguagesSchematron For Non-XML Languages
Schematron For Non-XML Languages
 
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
 
JSONSchema with golang
JSONSchema with golangJSONSchema with golang
JSONSchema with golang
 
Json
JsonJson
Json
 
JSON(JavaScript Object Notation)
JSON(JavaScript Object Notation)JSON(JavaScript Object Notation)
JSON(JavaScript Object Notation)
 
Working with JSON
Working with JSONWorking with JSON
Working with JSON
 
Intro to JSON
Intro to JSONIntro to JSON
Intro to JSON
 
Java-JSON-Jackson
Java-JSON-JacksonJava-JSON-Jackson
Java-JSON-Jackson
 

More from Octavian Nadolu

YAML Editing and Validation In Oxygen
YAML Editing and Validation In OxygenYAML Editing and Validation In Oxygen
YAML Editing and Validation In OxygenOctavian Nadolu
 
Leveraging the Power of AI and Schematron for Content Verification and Correc...
Leveraging the Power of AI and Schematron for Content Verification and Correc...Leveraging the Power of AI and Schematron for Content Verification and Correc...
Leveraging the Power of AI and Schematron for Content Verification and Correc...Octavian Nadolu
 
OpenAPI/AsyncAPI Support in Oxygen
OpenAPI/AsyncAPI Support in OxygenOpenAPI/AsyncAPI Support in Oxygen
OpenAPI/AsyncAPI Support in OxygenOctavian Nadolu
 
Validating XML and JSON Documents Using Oxygen Scripting
 Validating XML and JSON Documents Using Oxygen Scripting Validating XML and JSON Documents Using Oxygen Scripting
Validating XML and JSON Documents Using Oxygen ScriptingOctavian Nadolu
 
OpenAPI Editing, Testing, and Documenting
OpenAPI Editing, Testing, and DocumentingOpenAPI Editing, Testing, and Documenting
OpenAPI Editing, Testing, and DocumentingOctavian Nadolu
 
JSON, JSON Schema, and OpenAPI
JSON, JSON Schema, and OpenAPIJSON, JSON Schema, and OpenAPI
JSON, JSON Schema, and OpenAPIOctavian Nadolu
 
Compare And Merge Scripts
Compare And Merge ScriptsCompare And Merge Scripts
Compare And Merge ScriptsOctavian Nadolu
 
HTML5 Editing Validation
HTML5 Editing ValidationHTML5 Editing Validation
HTML5 Editing ValidationOctavian Nadolu
 
Documentation Quality Assurance with ISO Schematron
Documentation Quality Assurance with ISO SchematronDocumentation Quality Assurance with ISO Schematron
Documentation Quality Assurance with ISO SchematronOctavian Nadolu
 
Introduction to Schematron
Introduction to SchematronIntroduction to Schematron
Introduction to SchematronOctavian Nadolu
 
JSON Edit, Validate, Query, Transform, and Convert
JSON Edit, Validate, Query, Transform, and ConvertJSON Edit, Validate, Query, Transform, and Convert
JSON Edit, Validate, Query, Transform, and ConvertOctavian Nadolu
 
The Power Of Schematron Quick Fixes - XML Prague 2019
The Power Of Schematron Quick Fixes - XML Prague 2019The Power Of Schematron Quick Fixes - XML Prague 2019
The Power Of Schematron Quick Fixes - XML Prague 2019Octavian Nadolu
 
Collaboration Tools to Help Improve Documentation Process
Collaboration Tools to Help Improve Documentation ProcessCollaboration Tools to Help Improve Documentation Process
Collaboration Tools to Help Improve Documentation ProcessOctavian Nadolu
 
Exploring the new features in Oxygen XML Editor 20 - Development
Exploring the new features in Oxygen XML Editor 20 - DevelopmentExploring the new features in Oxygen XML Editor 20 - Development
Exploring the new features in Oxygen XML Editor 20 - DevelopmentOctavian Nadolu
 
Comparing and Merging XML Documents in Visual Mode
Comparing and Merging XML Documents in Visual ModeComparing and Merging XML Documents in Visual Mode
Comparing and Merging XML Documents in Visual ModeOctavian Nadolu
 
Schematron 2016 and SQF Update
Schematron 2016 and SQF Update Schematron 2016 and SQF Update
Schematron 2016 and SQF Update Octavian Nadolu
 
XSLT 3.0 Improvements - XML Prague 2018
XSLT 3.0 Improvements - XML Prague 2018XSLT 3.0 Improvements - XML Prague 2018
XSLT 3.0 Improvements - XML Prague 2018Octavian Nadolu
 

More from Octavian Nadolu (20)

YAML Editing and Validation In Oxygen
YAML Editing and Validation In OxygenYAML Editing and Validation In Oxygen
YAML Editing and Validation In Oxygen
 
Oxygen JSON Editor
Oxygen JSON EditorOxygen JSON Editor
Oxygen JSON Editor
 
Leveraging the Power of AI and Schematron for Content Verification and Correc...
Leveraging the Power of AI and Schematron for Content Verification and Correc...Leveraging the Power of AI and Schematron for Content Verification and Correc...
Leveraging the Power of AI and Schematron for Content Verification and Correc...
 
OpenAPI/AsyncAPI Support in Oxygen
OpenAPI/AsyncAPI Support in OxygenOpenAPI/AsyncAPI Support in Oxygen
OpenAPI/AsyncAPI Support in Oxygen
 
Validating XML and JSON Documents Using Oxygen Scripting
 Validating XML and JSON Documents Using Oxygen Scripting Validating XML and JSON Documents Using Oxygen Scripting
Validating XML and JSON Documents Using Oxygen Scripting
 
OpenAPI Editing, Testing, and Documenting
OpenAPI Editing, Testing, and DocumentingOpenAPI Editing, Testing, and Documenting
OpenAPI Editing, Testing, and Documenting
 
JSON, JSON Schema, and OpenAPI
JSON, JSON Schema, and OpenAPIJSON, JSON Schema, and OpenAPI
JSON, JSON Schema, and OpenAPI
 
Compare And Merge Scripts
Compare And Merge ScriptsCompare And Merge Scripts
Compare And Merge Scripts
 
JSON Schema Design
JSON Schema DesignJSON Schema Design
JSON Schema Design
 
HTML5 Editing Validation
HTML5 Editing ValidationHTML5 Editing Validation
HTML5 Editing Validation
 
Documentation Quality Assurance with ISO Schematron
Documentation Quality Assurance with ISO SchematronDocumentation Quality Assurance with ISO Schematron
Documentation Quality Assurance with ISO Schematron
 
Introduction to Schematron
Introduction to SchematronIntroduction to Schematron
Introduction to Schematron
 
JSON Edit, Validate, Query, Transform, and Convert
JSON Edit, Validate, Query, Transform, and ConvertJSON Edit, Validate, Query, Transform, and Convert
JSON Edit, Validate, Query, Transform, and Convert
 
The Power Of Schematron Quick Fixes - XML Prague 2019
The Power Of Schematron Quick Fixes - XML Prague 2019The Power Of Schematron Quick Fixes - XML Prague 2019
The Power Of Schematron Quick Fixes - XML Prague 2019
 
Collaboration Tools to Help Improve Documentation Process
Collaboration Tools to Help Improve Documentation ProcessCollaboration Tools to Help Improve Documentation Process
Collaboration Tools to Help Improve Documentation Process
 
Schematron step-by-step
Schematron step-by-stepSchematron step-by-step
Schematron step-by-step
 
Exploring the new features in Oxygen XML Editor 20 - Development
Exploring the new features in Oxygen XML Editor 20 - DevelopmentExploring the new features in Oxygen XML Editor 20 - Development
Exploring the new features in Oxygen XML Editor 20 - Development
 
Comparing and Merging XML Documents in Visual Mode
Comparing and Merging XML Documents in Visual ModeComparing and Merging XML Documents in Visual Mode
Comparing and Merging XML Documents in Visual Mode
 
Schematron 2016 and SQF Update
Schematron 2016 and SQF Update Schematron 2016 and SQF Update
Schematron 2016 and SQF Update
 
XSLT 3.0 Improvements - XML Prague 2018
XSLT 3.0 Improvements - XML Prague 2018XSLT 3.0 Improvements - XML Prague 2018
XSLT 3.0 Improvements - XML Prague 2018
 

Recently uploaded

%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
SHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationSHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationShrmpro
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsBert Jan Schrijver
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfayushiqss
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Hararemasabamasaba
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfproinshot.com
 
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburgmasabamasaba
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 

Recently uploaded (20)

%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
SHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationSHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions Presentation
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 

JSON and JSON Schema in Oxygen

  • 1. JSON and JSON Schema Support © 2020 Syncro Soft SRL. All rights reserved. Octavian Nadolu, Syncro Soft octavian_nadolu@oxygenxml.com @OctavianNadolu
  • 2. JSON Features Agenda ● JSON and JSON Schema in Oxygen ● Validating JSON with Schematron ● Convert between JSON and XML ● XSD to JSON schema converter ● Instance generator from a JSON Schema ● Generate JSON Schema from JSON instance
  • 3. JSON Features JSON (JavaScript Object Notation) ● Data representation format ● Used for API and Configs ● Lightweight and easy to read/write http://json.org
  • 4. JSON Features JSON Documents Structure ● JSON Data – name/value pair ● JSON Object {...} ● JSON Array [...]
  • 5. JSON Features Validating JSON Documents ● Checking Well-Formedness in JSON Documents ● Validating JSON Documents Against JSON Schema ● Validating JSON Schema According to the Specification
  • 6. JSON Features Checking Well-Formedness Check if the JSON document respects the JSON specification { "id": "jane.doe", "firstname": "Jane", "lastname": "Doe", "email": "jane@oxygenxml.com", "age": 37 } ECMA-404 The JSON Data Interchange Standard http://json.org/
  • 7. JSON Features Example { "persons" [ { "id": "jane.doe", "firstname": "Jane", "lastname": "Doe", "email": "jane@oxygenxml.com" "age": 37, }, { "id": "john.jones, "firtname": "John", "lastname": "Jones, "email": "john@oxygenxml.com", "age": 42 ] } Expected ',' character Unexpected ',' character Expected a ':' after a key Expected quotes Expected '}'
  • 8. JSON Features JSON Schema JSON Schema is a vocabulary that allows you to annotate and validate JSON documents http://json-schema.org
  • 9. JSON Features Defining JSON Schema ● Similar to XML Schema, RNG, or DTD ● Written in JSON ● Used to define the structure of a JSON data {”type”: ”string”} JSON Schema ”I'm a string” JSON Instance
  • 10. JSON Features JSON Schema Definition ● It is recommended to to have the schema definition on the first level "$schema": "http://json-schema.org/draft-07/schema#" ● JSON Schema used versions: – Draft 4 – Draft 6 – Draft 7 – Draft 8 (2019-09)
  • 11. JSON Features Associate JSON Schema ● Associating a Schema to JSON Documents – Directly in JSON document – using $schema property – In application options { "$schema": "person-schema.json", "persons" [ ... ] } Absolute or relative URI
  • 12. JSON Features Validating JSON Schema ● Check for well-formedness ● Validate accordingly to the Internet Engineering Task Force (IETF) Specification
  • 13. JSON Features Validating JSON with Schematron ● Specify the JSON structure using JSON Schema ● Express co-constraints and define custom rules using Schematron
  • 14. JSON Features Schematron for JSON ● Use XPath to express the rules <sch:rule context="persons"> <sch:assert test="number(age) > preceding-sibling::node()/age "> The person age must be grater than the previous person age </sch:assert> </sch:rule>
  • 15. JSON Features Editing JSON ● JSON Text and Grid Editing Mode ● JSON Outline View ● Content Completion Assistant in JSON ● Associate JSON Schema to JSON Documents
  • 16. JSON Features Text and Grid Editing Mode
  • 17. JSON Features JSON Outline View ● Document Overview ● Synchronization with Editor ● Filtering ● Error Markers
  • 18. JSON Features Associate JSON Schema ● Associating a Schema to JSON Documents – Directly in JSON Documents – Through a Validation Scenario
  • 19. JSON Features Content Completion ● Context-Sensitive ● Valid Proposals ● Documentation from Schema ● Code Templates
  • 20. JSON Features Querying and Transforming ● Query using XPath ● Transform JSON using XSLT and XQuery
  • 21. JSON Features XPath ● XPath Toolbar and XPath Builder View ● Content Completion ● XPath Over Multiple Files
  • 22. JSON Features Transform using XSLT/XQuery ● Transform JSON Documents to Different Formats ● Create XSLT/XQuery Transformation Scenario for JSON ● XQuery Builder view ● Functions to process JSON document: ● json-doc($href as xs:string?) as item()? ● json-to-xml($json-text as xs:string?) as document-node()?
  • 23. JSON Features JSON Tools ● Convert between JSON and XML ● XSD to JSON Schema converter ● Instance generator from a JSON Schema ● Generate JSON Schema from JSON instance
  • 24. JSON Features JSON to XML { "personnel": { "person": [ { "id": 1, "name": { "family": "Worker", "given": "One" }, "email": "one@oxygenxml.com", "link": {"manager": "Big.Boss"} }, { "id": 2, "name": { "family": "Worker", "given": "Two" }, "email": "two@oxygenxml.com", "link": {"manager": "Big.Boss"} } ] } } <personnel> <person> <id>1</id> <name> <family>Worker</family> <given>One</given> </name> <email>one@oxygenxml.com</email> <link> <manager>Big.Boss</manager> </link> </person> <person> <id>2</id> <name> <family>Worker</family> <given>Two</given> </name> <email>two@oxygenxml.com</email> <link> <manager>Big.Boss</manager> </link> </person> </personnel>
  • 25. JSON Features JSON to XML Conversion Details ● A <JSON> element is added as root if the converted JSON has multiple properties on the first level ● An <array> element is added as root if the converted JSON is an array [ {"name": "Boss"}, {"name": "Worker"} ] <array> <array> <name>Boss</name> </array> <array> <name>Worker</name> </array> </array> { "person": "one", "id": "personnel-id" } <JSON> <person>one</person> <id>personnel-id</id> </JSON> oxygenxml.com/doc/ug-editor/topics/convert-JSON-to-XML-x-tools.html
  • 26. JSON Features 1 XML to JSON <personnel> <person id="1"> <name> <family>Worker</family> <given>One</given> </name> <email>one@oxygenxml.com</email> <link manager="harris.anderson"/> </person> <person> <id>2</id> <name> <family>Worker</family> <given>Two</given> </name> <email>two@oxygenxml.com</email> <link manager="harris.anderson"/> </person> </personnel> { "personnel": { "person": [ { "id": 1, "name": { "family": "Worker", "given": "One" }, "email": "one@oxygenxml.com", "link": {"manager": "harris.anderson"} }, { "id": 2, "name": { "family": "Worker", "given": "Two" }, "email": "two@oxygenxml.com", "link": {"manager": "harris.anderson"} } ] } }
  • 27. JSON Features XML to JSON Conversion Details ● XML attributes are converted to properties <person id="1"/> {"person": {"id": 1}} ● Multiple elements with the same name are converted into an array <person>One</person> "person": ["One","Two"] <person>Two</person> ● Text in mixed content will be converted in a #text property <p>This is an <b>example</b>!</p> p": {"#text": "This is an", "b": "example", "#text1": "!"} oxygenxml.com/doc/ug-editor/topics/convert-XML-to-JSON-x-tools.html
  • 28. JSON Features XSD to JSON Schema converter ● Tool for converting an XML Schema file (XSD) to a JSON Schema oxygenxml.com/doc/ug-editor/topics/xsd-to-json-schema-converter-x.html
  • 29. JSON Features Instance generator from a JSON Schema ● Tool for generating sample JSON files from a JSON Schema oxygenxml.com/doc/ug-editor/topics/json-schema-instance-generator.html
  • 30. JSON Features Generate JSON Schema from JSON instance ● Tool for generating JSON Schema oxygenxml.com/doc/ug-editor/topics/json-schema-instance-generator.html
  • 31. JSON Features Conclusion ● JSON conforms to ECMA/ISO specification ● Validate JSON with JSON Schema and Schematron ● Editing based on JSON Schema ● Query and process JSON using XPath, XSLT/XQuery ● Useful JSON Tools
  • 32. Questions? Octavian Nadolu Software Architect at Syncro Soft octavian.nadolu@oxygenxml.com Twitter: @OctavianNadolu LinkedIn: octaviannadolu