SlideShare a Scribd company logo
1 of 39
Download to read offline
1
U2 Dynamic Objects (UDO)
for JSON and XML
Michael Byrne, MultiValue Evangelist
2
Abstract
 U2 Dynamic Objects (UDO) let you interact with JSON and XML as
objects. This can be useful when dealing with these universal data
formats. Whether you are consuming or creating Web services, or just
simply need to work with JSON/XML, UDO will get you there more quickly
and more reliably.
©2015 Rocket Software, Inc. All Rights Reserved.
3
Agenda
What are JSON and XML?
UDO availability, definition, and overview
Examples
• Consuming JSON Web Service
• Consuming XML Web Service
• Creating JSON
• Creating XML
• Consuming a complex JSON API (time permitting)
©2015 Rocket Software, Inc. All Rights Reserved.
4
What is JSON
JavaScript Object Notation
Human readable text used to transmit data
• Attribute-Value pairs
• Open standard format
• Language independent
Easily read by many programming languages
©2015 Rocket Software, Inc. All Rights Reserved.
5
JSON Example
{
"invoiceId": "10-ABC-2111",
"customer": 8001,
"items": [
{ "itemId": 33, "price": 21.99 },
{ "itemId": 76, "price": 129 }
]
}
©2015 Rocket Software, Inc. All Rights Reserved.
6
What is XML
Markup language for encoding documents
• Human-readable and machine-readable
Standardized
Mature
Not specifically SOAP
©2015 Rocket Software, Inc. All Rights Reserved.
7
XML Example
<invoice>
<invoiceId>10-ABC-2111</invoiceId>
<customer>8001</customer>
<items>
<item><itemId>33</itemId><price>21.99</price></item>
<item><itemId>76</itemId><price>129</price></item>
</items>
</invoice>
©2015 Rocket Software, Inc. All Rights Reserved.
8
UDO Overview
 Not persistent; in-memory only
 Purely a data object; no method
support
 Dynamic; properties can be
added/removed on the fly
 No inheritance
 Unlimited nesting levels
 Can create objects from XML/JSON or
can be serialized into XML/JSON
©2015 Rocket Software, Inc. All Rights Reserved.
UDO Object
{
“location”:”Denver”,
“address”:”123 Main St”,
“phones”: [
“303-555-1212”,
“720-555-3434”
]
}
9
UDO Availability
©2015 Rocket Software, Inc. All Rights Reserved.
11.2.0
(JSON/XML)
UniVerse
7.3 (JSON)
8.1 (XML)
UniData
Included in database engine (no charge)
Set of Basic functions to work with objects
Based on JSON specification
• XML is achieved via conversion from JSON to XML
• May not always be able to get back original XML
10
Benefits of an Object Interface
Less error prone
• Concatenation
• Manual parsing
Shorter development time
Error handling
©2015 Rocket Software, Inc. All Rights Reserved.
11
UDO Usage Overview
©2015 Rocket Software, Inc. All Rights Reserved.
UDOCreate(UDO_OBJECT,{name})
UDO Object
…
Get/Set Properties…
(UDOGetProperty/UDOSetProperty)
…
{
“location”:”Denver”,
“address”:”123 Main St”,
“phones”: [
“303-555-1212”,
“720-555-3434”
]
}
UDOFree({name})
$INCLUDE INCLUDES UDO.H
12
UDO Value Types
©2015 Rocket Software, Inc. All Rights Reserved.
UDO Object
{
“locationId”: 1001,
“location”: ”Denver”,
“valid”: true,
“address”: ”123 Main St”,
“phones”: [
“303-555-1212”,
“720-555-3434”
],
“nulltest”: null
}
Object
Array
Number
String
Boolean
Null
13
Parsing JSON
14
Popular Google API Examples
©2015 Rocket Software, Inc. All Rights Reserved.
15
Parsing JSON From Web Service
Google Time Zone API
https://maps.googleapis.com/maps/api/timezone/json
• location=36.114647,-115.172813 (Las Vegas, NV)
• timestamp={timestamp}
• key={api_key}
©2015 Rocket Software, Inc. All Rights Reserved.
16
Google Time Zone Response - JSON
©2015 Rocket Software, Inc. All Rights Reserved.
{
"dstOffset" : 3600,
"rawOffset" : -28800,
"status" : "OK",
"timeZoneId" : "America/Los_Angeles",
"timeZoneName" : "Pacific Daylight Time"
}
17
Get Time Zone Basic Program
©2015 Rocket Software, Inc. All Rights Reserved.
Submit
request via
CallHTTP
Google Time Zone API
{
"dstOffset" : 3600,
"rawOffset" : -28800,
"status" : "OK",
"timeZoneId" : "America/Los_Angeles",
"timeZoneName" : "Pacific Daylight Time"
}
Read into
UDO
object
Parse
Values
Get
Response
(String)
18
Parsing the JSON with UDO
©2015 Rocket Software, Inc. All Rights Reserved.
UDOGetProperty(RESTMSG, "dstOffset", dstOffset, UDOTYPE)
UDOGetProperty(RESTMSG, "rawOffset", rawOffset, UDOTYPE)
UDOGetProperty(RESTMSG, "status", status, UDOTYPE)
UDOGetProperty(RESTMSG, "timeZoneId", zoneId, UDOTYPE)
UDOGetProperty(RESTMSG, "timeZoneName", zoneName, UDOTYPE)
{
"dstOffset" : 3600,
"rawOffset" : -28800,
"status" : "OK",
"timeZoneId" : "America/Los_Angeles",
"timeZoneName" : "Pacific Daylight Time"
}
UDORead(data, UDOFORMAT_JSON, RESTMSG)
19
Parsing XML
20
Parsing XML From Web Service
Google Time Zone API
Using same API, but specify XML response
https://maps.googleapis.com/maps/api/timezone/xml
• location=36.114647,-115.172813 (Las Vegas, NV)
• timestamp={timestamp}
• key={api_key}
©2015 Rocket Software, Inc. All Rights Reserved.
21
Google Time Zone Response - XML
<TimeZoneResponse>
<status>OK</status>
<raw_offset>-28800.0000000</raw_offset>
<dst_offset>3600.0000000</dst_offset>
<time_zone_id>America/Los_Angeles</time_zone_id>
<time_zone_name>Pacific Daylight Time</time_zone_name>
</TimeZoneResponse>
©2015 Rocket Software, Inc. All Rights Reserved.
Note property names
22
Parsing the XML with UDO
©2015 Rocket Software, Inc. All Rights Reserved.
UDOGetProperty(RESTMSG, “status", dstStatus, UDOTYPE)
UDOGetProperty(RESTMSG, "raw_offset", rawOffset, UDOTYPE)
UDOGetProperty(RESTMSG, “dst_offset", dstOffset, UDOTYPE)
UDOGetProperty(RESTMSG, "time_zone_id", zoneId, UDOTYPE)
UDOGetProperty(RESTMSG, "time_zone_name", zoneName, UDOTYPE)
<TimeZoneResponse>
<status>OK</status>
<raw_offset>-28800.0000000</raw_offset>
<dst_offset>3600.0000000</dst_offset>
<time_zone_id>America/Los_Angeles</time_zone_id>
<time_zone_name>Pacific Daylight Time</time_zone_name>
</TimeZoneResponse>
UDORead(data, UDOFORMAT_XML, RESTMSG)
23
Creating JSON
24
{
}
Creating JSON
{
}
{
"subprop1": "detail1"
}
{
"subprop1": "detail1",
"subprop2": "detail2"
}
{
"mainprop": 9876
}
{
"mainprop": 9876,
"subobject": {
"subprop1": "detail1",
"subprop2": "detail2"
}
}
©2015 Rocket Software, Inc. All Rights Reserved.
26
Creating JSON For REST Developer Tool
U2 REST Tool supports JSON data type
Build exact JSON in Basic to return if desired
Could also parse incoming JSON
©2015 Rocket Software, Inc. All Rights Reserved.
27
Creating XML
28
Creating XML
Remember, UDO is based on JSON specification
Simple interface, limited functionality
• No mixing attributes and elements
• Once XML convert to UDO, may not always be able to
convert back to original
For full XML support, use XDOM Basic functions
©2015 Rocket Software, Inc. All Rights Reserved.
29
Creating XML
<configuration>
<appSettings>
<add key="AppKey" value="AE48CA1F" />
</appSettings>
<system.web>
<compilation debug="true" strict="true" />
</system.web>
</configuration>
©2015 Rocket Software, Inc. All Rights Reserved.
30
Also JSON
©2015 Rocket Software, Inc. All Rights Reserved.
{
"appSettings": {
"add": {
"key": "AppKey",
"value": "AE48CA1F"
}
},
"system.web": {
"compilation": {
"debug": "true",
"strict": "true"
}
}
}
31
Note Differences Between JSON and XML
©2015 Rocket Software, Inc. All Rights Reserved.
<configuration>
<appSettings>
<add key="AppKey" value="AE48CA1F" />
</appSettings>
<system.web>
<compilation debug="true" strict="true" />
</system.web>
</configuration>
{
"appSettings": {
"add": {
"key": "AppKey",
"value": "AE48CA1F"
}
},
"system.web": {
"compilation": {
"debug": "true",
"strict": "true"
}
}
}
JSON XML
32
Complex JSON Parsing Example
33
Weather Service
©2015 Rocket Software, Inc. All Rights Reserved.
34
UDO.GETWEATHER
©2015 Rocket Software, Inc. All Rights Reserved.
UDOGetProperty(RESTMSG, "forecast", forecast, UDOTYPE)
UDOGetProperty(forecast, "simpleforecast", simple, UDOTYPE)
UDOGetProperty(simple, "forecastday", arrDays, UDOTYPE)
GETSTAT = UDO_SUCCESS
i = 0
LOOP
GETSTAT = UDOArrayGetNextItem(arrDays, W.UDO, W.TYPE)
WHILE GETSTAT = UDO_SUCCESS DO
i = i + 1
UDOGetProperty(W.UDO, "date", UDO.DATE, UDOTYPE)
UDOGetProperty(UDO.DATE, "monthname", F.MONTH, UDOTYPE)
UDOGetProperty(UDO.DATE, "day", F.DAY, UDOTYPE)
UDOGetProperty(UDO.DATE, "year", F.YEAR, UDOTYPE)
UDOGetProperty(W.UDO, "high", UDO.HIGH, UDOTYPE)
UDOGetProperty(UDO.HIGH, "fahrenheit", HF, UDOTYPE)
UDOGetProperty(W.UDO, "low", UDO.LOW, UDOTYPE)
UDOGetProperty(UDO.LOW, "fahrenheit", LF, UDOTYPE)
UDOGetProperty(W.UDO, "conditions", CONDITIONS, UDOTYPE)
REPEAT
35
Additional Resources
 https://en.wikipedia.org/wiki/JSON
 https://en.wikipedia.org/wiki/XML
 https://developers.google.com/maps/documentation/timezone/intro
 http://www.rocketsoftware.com/resource/u2-technical-documentation
• Find the Basic Extensions Guide for your data server version
©2015 Rocket Software, Inc. All Rights Reserved.
36
Next Steps
Download the UDO documentation found in Basic
Extensions manual
Get sample code from GitHub
©2015 Rocket Software, Inc. All Rights Reserved.
37
Summary
UDO can be used to parse or create JSON/XML
Based on the JSON specification,
XML mileage may vary
Could be paired with the RESTful Web Services tool
©2015 Rocket Software, Inc. All Rights Reserved.
38
Disclaimer
THE INFORMATION CONTAINED IN THIS PRESENTATION IS PROVIDED FOR INFORMATIONAL PURPOSES ONLY.
WHILE EFFORTS WERE MADE TO VERIFY THE COMPLETENESS AND ACCURACY OF THE INFORMATION CONTAINED
IN THIS PRESENTATION, IT IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED.
IN ADDITION, THIS INFORMATION IS BASED ON ROCKET SOFTWARE’S CURRENT PRODUCT PLANS AND STRATEGY,
WHICH ARE SUBJECT TO CHANGE BY ROCKET SOFTWAREWITHOUT NOTICE.
ROCKET SOFTWARE SHALL NOT BE RESPONSIBLE FOR ANY DAMAGES ARISING OUT OF THE USE OF, OR
OTHERWISE RELATED TO, THIS PRESENTATION OR ANY OTHER DOCUMENTATION.
NOTHING CONTAINED IN THIS PRESENTATION IS INTENDED TO, OR SHALL HAVE THE EFFECT OF:
• CREATING ANY WARRANTY OR REPRESENTATION FROM ROCKET SOFTWARE(OR ITS AFFILIATES OR ITS OR
THEIR SUPPLIERS AND/OR LICENSORS); OR
• ALTERING THE TERMS AND CONDITIONS OF THE APPLICABLE LICENSE AGREEMENT GOVERNING THE USE OF
ROCKET SOFTWARE.
©2015 Rocket Software, Inc. All Rights Reserved.
39
Trademarks and Acknowledgements
The trademarks and service marks identified in the following list are the exclusive properties of Rocket Software,
Inc. and its subsidiaries (collectively, “Rocket Software”). These marks are registered with the U.S. Patent and
Trademark Office, and may be registered or pending registration in other countries. Not all trademarks owned by
Rocket Software are listed. The absence of a mark from this page neither constitutes a waiver of any intellectual
property rights that Rocket Software has established in its marks nor means that Rocket Software is not owner of
any such marks.
Aldon, CorVu, Dynamic Connect, D3, FlashConnect, Pick, mvBase, MvEnterprise, NetCure,
Rocket, SystemBuilder, U2, U2 Web Development Environment, UniData, UniVerse, and
wIntegrate
Other company, product, and service names mentioned herein may be trademarks or service marks of
others.
©2015 Rocket Software, Inc. All Rights Reserved.
40

More Related Content

Similar to U2 Dynamic Objects for JSON and XML

RUNDECK PRO - example acl policy convention
RUNDECK PRO -  example acl policy conventionRUNDECK PRO -  example acl policy convention
RUNDECK PRO - example acl policy conventionsimplifyops
 
Java EE 8 - An instant snapshot
Java EE 8 - An instant snapshotJava EE 8 - An instant snapshot
Java EE 8 - An instant snapshotDavid Delabassee
 
Ionic2, les développeurs web à l'assaut du mobile, BDX I/O le 21/10/2016
Ionic2, les développeurs web à l'assaut du mobile, BDX I/O le 21/10/2016Ionic2, les développeurs web à l'assaut du mobile, BDX I/O le 21/10/2016
Ionic2, les développeurs web à l'assaut du mobile, BDX I/O le 21/10/2016Loïc Knuchel
 
EDINA's Open Geo-Services
EDINA's Open Geo-ServicesEDINA's Open Geo-Services
EDINA's Open Geo-ServicesAddy Pope
 
Android101 : Introduksjon til Android
Android101 : Introduksjon til AndroidAndroid101 : Introduksjon til Android
Android101 : Introduksjon til AndroidTruls Jørgensen
 
CouchDB on Android
CouchDB on AndroidCouchDB on Android
CouchDB on AndroidSven Haiges
 
Fast REST APIs Development with MongoDB
Fast REST APIs Development with MongoDBFast REST APIs Development with MongoDB
Fast REST APIs Development with MongoDBMongoDB
 
Java 5 PSM for DDS: Initial Submission (out of date)
Java 5 PSM for DDS: Initial Submission (out of date)Java 5 PSM for DDS: Initial Submission (out of date)
Java 5 PSM for DDS: Initial Submission (out of date)Rick Warren
 
Application Development & Database Choices: Postgres Support for non Relation...
Application Development & Database Choices: Postgres Support for non Relation...Application Development & Database Choices: Postgres Support for non Relation...
Application Development & Database Choices: Postgres Support for non Relation...EDB
 
Integrate Solr with real-time stream processing applications
Integrate Solr with real-time stream processing applicationsIntegrate Solr with real-time stream processing applications
Integrate Solr with real-time stream processing applicationslucenerevolution
 
Where are yours vertexes and what are they talking about?
Where are yours vertexes and what are they talking about?Where are yours vertexes and what are they talking about?
Where are yours vertexes and what are they talking about?Roberto Franchini
 
Reactive Stream Processing Using DDS and Rx
Reactive Stream Processing Using DDS and RxReactive Stream Processing Using DDS and Rx
Reactive Stream Processing Using DDS and RxSumant Tambe
 
Serving Ireland's Geospatial Information as Linked Data
Serving Ireland's Geospatial Information as Linked DataServing Ireland's Geospatial Information as Linked Data
Serving Ireland's Geospatial Information as Linked DataChristophe Debruyne
 
Java EE 8 - An instant snapshot
Java EE 8 - An instant snapshot Java EE 8 - An instant snapshot
Java EE 8 - An instant snapshot David Delabassee
 
MongoDB.local Atlanta: MongoDB Mobile: Bringing the Power of MongoDB to Your ...
MongoDB.local Atlanta: MongoDB Mobile: Bringing the Power of MongoDB to Your ...MongoDB.local Atlanta: MongoDB Mobile: Bringing the Power of MongoDB to Your ...
MongoDB.local Atlanta: MongoDB Mobile: Bringing the Power of MongoDB to Your ...MongoDB
 

Similar to U2 Dynamic Objects for JSON and XML (20)

Minicurso Android
Minicurso AndroidMinicurso Android
Minicurso Android
 
RUNDECK PRO - example acl policy convention
RUNDECK PRO -  example acl policy conventionRUNDECK PRO -  example acl policy convention
RUNDECK PRO - example acl policy convention
 
Java EE 8 - An instant snapshot
Java EE 8 - An instant snapshotJava EE 8 - An instant snapshot
Java EE 8 - An instant snapshot
 
Trimming The Cruft
Trimming The CruftTrimming The Cruft
Trimming The Cruft
 
Ionic2, les développeurs web à l'assaut du mobile, BDX I/O le 21/10/2016
Ionic2, les développeurs web à l'assaut du mobile, BDX I/O le 21/10/2016Ionic2, les développeurs web à l'assaut du mobile, BDX I/O le 21/10/2016
Ionic2, les développeurs web à l'assaut du mobile, BDX I/O le 21/10/2016
 
MeteorJS Meetup
MeteorJS MeetupMeteorJS Meetup
MeteorJS Meetup
 
EDINA's Open Geo-Services
EDINA's Open Geo-ServicesEDINA's Open Geo-Services
EDINA's Open Geo-Services
 
Android101 : Introduksjon til Android
Android101 : Introduksjon til AndroidAndroid101 : Introduksjon til Android
Android101 : Introduksjon til Android
 
Introduction to Domain-Driven Design
Introduction to Domain-Driven DesignIntroduction to Domain-Driven Design
Introduction to Domain-Driven Design
 
CouchDB on Android
CouchDB on AndroidCouchDB on Android
CouchDB on Android
 
Fast REST APIs Development with MongoDB
Fast REST APIs Development with MongoDBFast REST APIs Development with MongoDB
Fast REST APIs Development with MongoDB
 
Java 5 PSM for DDS: Initial Submission (out of date)
Java 5 PSM for DDS: Initial Submission (out of date)Java 5 PSM for DDS: Initial Submission (out of date)
Java 5 PSM for DDS: Initial Submission (out of date)
 
Application Development & Database Choices: Postgres Support for non Relation...
Application Development & Database Choices: Postgres Support for non Relation...Application Development & Database Choices: Postgres Support for non Relation...
Application Development & Database Choices: Postgres Support for non Relation...
 
Integrate Solr with real-time stream processing applications
Integrate Solr with real-time stream processing applicationsIntegrate Solr with real-time stream processing applications
Integrate Solr with real-time stream processing applications
 
Apache solr
Apache solrApache solr
Apache solr
 
Where are yours vertexes and what are they talking about?
Where are yours vertexes and what are they talking about?Where are yours vertexes and what are they talking about?
Where are yours vertexes and what are they talking about?
 
Reactive Stream Processing Using DDS and Rx
Reactive Stream Processing Using DDS and RxReactive Stream Processing Using DDS and Rx
Reactive Stream Processing Using DDS and Rx
 
Serving Ireland's Geospatial Information as Linked Data
Serving Ireland's Geospatial Information as Linked DataServing Ireland's Geospatial Information as Linked Data
Serving Ireland's Geospatial Information as Linked Data
 
Java EE 8 - An instant snapshot
Java EE 8 - An instant snapshot Java EE 8 - An instant snapshot
Java EE 8 - An instant snapshot
 
MongoDB.local Atlanta: MongoDB Mobile: Bringing the Power of MongoDB to Your ...
MongoDB.local Atlanta: MongoDB Mobile: Bringing the Power of MongoDB to Your ...MongoDB.local Atlanta: MongoDB Mobile: Bringing the Power of MongoDB to Your ...
MongoDB.local Atlanta: MongoDB Mobile: Bringing the Power of MongoDB to Your ...
 

Recently uploaded

Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
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
 
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
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
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
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfryanfarris8
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
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
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 

Recently uploaded (20)

Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
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
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
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
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
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
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
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
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 

U2 Dynamic Objects for JSON and XML

  • 1. 1 U2 Dynamic Objects (UDO) for JSON and XML Michael Byrne, MultiValue Evangelist
  • 2. 2 Abstract  U2 Dynamic Objects (UDO) let you interact with JSON and XML as objects. This can be useful when dealing with these universal data formats. Whether you are consuming or creating Web services, or just simply need to work with JSON/XML, UDO will get you there more quickly and more reliably. ©2015 Rocket Software, Inc. All Rights Reserved.
  • 3. 3 Agenda What are JSON and XML? UDO availability, definition, and overview Examples • Consuming JSON Web Service • Consuming XML Web Service • Creating JSON • Creating XML • Consuming a complex JSON API (time permitting) ©2015 Rocket Software, Inc. All Rights Reserved.
  • 4. 4 What is JSON JavaScript Object Notation Human readable text used to transmit data • Attribute-Value pairs • Open standard format • Language independent Easily read by many programming languages ©2015 Rocket Software, Inc. All Rights Reserved.
  • 5. 5 JSON Example { "invoiceId": "10-ABC-2111", "customer": 8001, "items": [ { "itemId": 33, "price": 21.99 }, { "itemId": 76, "price": 129 } ] } ©2015 Rocket Software, Inc. All Rights Reserved.
  • 6. 6 What is XML Markup language for encoding documents • Human-readable and machine-readable Standardized Mature Not specifically SOAP ©2015 Rocket Software, Inc. All Rights Reserved.
  • 8. 8 UDO Overview  Not persistent; in-memory only  Purely a data object; no method support  Dynamic; properties can be added/removed on the fly  No inheritance  Unlimited nesting levels  Can create objects from XML/JSON or can be serialized into XML/JSON ©2015 Rocket Software, Inc. All Rights Reserved. UDO Object { “location”:”Denver”, “address”:”123 Main St”, “phones”: [ “303-555-1212”, “720-555-3434” ] }
  • 9. 9 UDO Availability ©2015 Rocket Software, Inc. All Rights Reserved. 11.2.0 (JSON/XML) UniVerse 7.3 (JSON) 8.1 (XML) UniData Included in database engine (no charge) Set of Basic functions to work with objects Based on JSON specification • XML is achieved via conversion from JSON to XML • May not always be able to get back original XML
  • 10. 10 Benefits of an Object Interface Less error prone • Concatenation • Manual parsing Shorter development time Error handling ©2015 Rocket Software, Inc. All Rights Reserved.
  • 11. 11 UDO Usage Overview ©2015 Rocket Software, Inc. All Rights Reserved. UDOCreate(UDO_OBJECT,{name}) UDO Object … Get/Set Properties… (UDOGetProperty/UDOSetProperty) … { “location”:”Denver”, “address”:”123 Main St”, “phones”: [ “303-555-1212”, “720-555-3434” ] } UDOFree({name}) $INCLUDE INCLUDES UDO.H
  • 12. 12 UDO Value Types ©2015 Rocket Software, Inc. All Rights Reserved. UDO Object { “locationId”: 1001, “location”: ”Denver”, “valid”: true, “address”: ”123 Main St”, “phones”: [ “303-555-1212”, “720-555-3434” ], “nulltest”: null } Object Array Number String Boolean Null
  • 14. 14 Popular Google API Examples ©2015 Rocket Software, Inc. All Rights Reserved.
  • 15. 15 Parsing JSON From Web Service Google Time Zone API https://maps.googleapis.com/maps/api/timezone/json • location=36.114647,-115.172813 (Las Vegas, NV) • timestamp={timestamp} • key={api_key} ©2015 Rocket Software, Inc. All Rights Reserved.
  • 16. 16 Google Time Zone Response - JSON ©2015 Rocket Software, Inc. All Rights Reserved. { "dstOffset" : 3600, "rawOffset" : -28800, "status" : "OK", "timeZoneId" : "America/Los_Angeles", "timeZoneName" : "Pacific Daylight Time" }
  • 17. 17 Get Time Zone Basic Program ©2015 Rocket Software, Inc. All Rights Reserved. Submit request via CallHTTP Google Time Zone API { "dstOffset" : 3600, "rawOffset" : -28800, "status" : "OK", "timeZoneId" : "America/Los_Angeles", "timeZoneName" : "Pacific Daylight Time" } Read into UDO object Parse Values Get Response (String)
  • 18. 18 Parsing the JSON with UDO ©2015 Rocket Software, Inc. All Rights Reserved. UDOGetProperty(RESTMSG, "dstOffset", dstOffset, UDOTYPE) UDOGetProperty(RESTMSG, "rawOffset", rawOffset, UDOTYPE) UDOGetProperty(RESTMSG, "status", status, UDOTYPE) UDOGetProperty(RESTMSG, "timeZoneId", zoneId, UDOTYPE) UDOGetProperty(RESTMSG, "timeZoneName", zoneName, UDOTYPE) { "dstOffset" : 3600, "rawOffset" : -28800, "status" : "OK", "timeZoneId" : "America/Los_Angeles", "timeZoneName" : "Pacific Daylight Time" } UDORead(data, UDOFORMAT_JSON, RESTMSG)
  • 20. 20 Parsing XML From Web Service Google Time Zone API Using same API, but specify XML response https://maps.googleapis.com/maps/api/timezone/xml • location=36.114647,-115.172813 (Las Vegas, NV) • timestamp={timestamp} • key={api_key} ©2015 Rocket Software, Inc. All Rights Reserved.
  • 21. 21 Google Time Zone Response - XML <TimeZoneResponse> <status>OK</status> <raw_offset>-28800.0000000</raw_offset> <dst_offset>3600.0000000</dst_offset> <time_zone_id>America/Los_Angeles</time_zone_id> <time_zone_name>Pacific Daylight Time</time_zone_name> </TimeZoneResponse> ©2015 Rocket Software, Inc. All Rights Reserved. Note property names
  • 22. 22 Parsing the XML with UDO ©2015 Rocket Software, Inc. All Rights Reserved. UDOGetProperty(RESTMSG, “status", dstStatus, UDOTYPE) UDOGetProperty(RESTMSG, "raw_offset", rawOffset, UDOTYPE) UDOGetProperty(RESTMSG, “dst_offset", dstOffset, UDOTYPE) UDOGetProperty(RESTMSG, "time_zone_id", zoneId, UDOTYPE) UDOGetProperty(RESTMSG, "time_zone_name", zoneName, UDOTYPE) <TimeZoneResponse> <status>OK</status> <raw_offset>-28800.0000000</raw_offset> <dst_offset>3600.0000000</dst_offset> <time_zone_id>America/Los_Angeles</time_zone_id> <time_zone_name>Pacific Daylight Time</time_zone_name> </TimeZoneResponse> UDORead(data, UDOFORMAT_XML, RESTMSG)
  • 24. 24 { } Creating JSON { } { "subprop1": "detail1" } { "subprop1": "detail1", "subprop2": "detail2" } { "mainprop": 9876 } { "mainprop": 9876, "subobject": { "subprop1": "detail1", "subprop2": "detail2" } } ©2015 Rocket Software, Inc. All Rights Reserved.
  • 25. 26 Creating JSON For REST Developer Tool U2 REST Tool supports JSON data type Build exact JSON in Basic to return if desired Could also parse incoming JSON ©2015 Rocket Software, Inc. All Rights Reserved.
  • 27. 28 Creating XML Remember, UDO is based on JSON specification Simple interface, limited functionality • No mixing attributes and elements • Once XML convert to UDO, may not always be able to convert back to original For full XML support, use XDOM Basic functions ©2015 Rocket Software, Inc. All Rights Reserved.
  • 28. 29 Creating XML <configuration> <appSettings> <add key="AppKey" value="AE48CA1F" /> </appSettings> <system.web> <compilation debug="true" strict="true" /> </system.web> </configuration> ©2015 Rocket Software, Inc. All Rights Reserved.
  • 29. 30 Also JSON ©2015 Rocket Software, Inc. All Rights Reserved. { "appSettings": { "add": { "key": "AppKey", "value": "AE48CA1F" } }, "system.web": { "compilation": { "debug": "true", "strict": "true" } } }
  • 30. 31 Note Differences Between JSON and XML ©2015 Rocket Software, Inc. All Rights Reserved. <configuration> <appSettings> <add key="AppKey" value="AE48CA1F" /> </appSettings> <system.web> <compilation debug="true" strict="true" /> </system.web> </configuration> { "appSettings": { "add": { "key": "AppKey", "value": "AE48CA1F" } }, "system.web": { "compilation": { "debug": "true", "strict": "true" } } } JSON XML
  • 32. 33 Weather Service ©2015 Rocket Software, Inc. All Rights Reserved.
  • 33. 34 UDO.GETWEATHER ©2015 Rocket Software, Inc. All Rights Reserved. UDOGetProperty(RESTMSG, "forecast", forecast, UDOTYPE) UDOGetProperty(forecast, "simpleforecast", simple, UDOTYPE) UDOGetProperty(simple, "forecastday", arrDays, UDOTYPE) GETSTAT = UDO_SUCCESS i = 0 LOOP GETSTAT = UDOArrayGetNextItem(arrDays, W.UDO, W.TYPE) WHILE GETSTAT = UDO_SUCCESS DO i = i + 1 UDOGetProperty(W.UDO, "date", UDO.DATE, UDOTYPE) UDOGetProperty(UDO.DATE, "monthname", F.MONTH, UDOTYPE) UDOGetProperty(UDO.DATE, "day", F.DAY, UDOTYPE) UDOGetProperty(UDO.DATE, "year", F.YEAR, UDOTYPE) UDOGetProperty(W.UDO, "high", UDO.HIGH, UDOTYPE) UDOGetProperty(UDO.HIGH, "fahrenheit", HF, UDOTYPE) UDOGetProperty(W.UDO, "low", UDO.LOW, UDOTYPE) UDOGetProperty(UDO.LOW, "fahrenheit", LF, UDOTYPE) UDOGetProperty(W.UDO, "conditions", CONDITIONS, UDOTYPE) REPEAT
  • 34. 35 Additional Resources  https://en.wikipedia.org/wiki/JSON  https://en.wikipedia.org/wiki/XML  https://developers.google.com/maps/documentation/timezone/intro  http://www.rocketsoftware.com/resource/u2-technical-documentation • Find the Basic Extensions Guide for your data server version ©2015 Rocket Software, Inc. All Rights Reserved.
  • 35. 36 Next Steps Download the UDO documentation found in Basic Extensions manual Get sample code from GitHub ©2015 Rocket Software, Inc. All Rights Reserved.
  • 36. 37 Summary UDO can be used to parse or create JSON/XML Based on the JSON specification, XML mileage may vary Could be paired with the RESTful Web Services tool ©2015 Rocket Software, Inc. All Rights Reserved.
  • 37. 38 Disclaimer THE INFORMATION CONTAINED IN THIS PRESENTATION IS PROVIDED FOR INFORMATIONAL PURPOSES ONLY. WHILE EFFORTS WERE MADE TO VERIFY THE COMPLETENESS AND ACCURACY OF THE INFORMATION CONTAINED IN THIS PRESENTATION, IT IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. IN ADDITION, THIS INFORMATION IS BASED ON ROCKET SOFTWARE’S CURRENT PRODUCT PLANS AND STRATEGY, WHICH ARE SUBJECT TO CHANGE BY ROCKET SOFTWAREWITHOUT NOTICE. ROCKET SOFTWARE SHALL NOT BE RESPONSIBLE FOR ANY DAMAGES ARISING OUT OF THE USE OF, OR OTHERWISE RELATED TO, THIS PRESENTATION OR ANY OTHER DOCUMENTATION. NOTHING CONTAINED IN THIS PRESENTATION IS INTENDED TO, OR SHALL HAVE THE EFFECT OF: • CREATING ANY WARRANTY OR REPRESENTATION FROM ROCKET SOFTWARE(OR ITS AFFILIATES OR ITS OR THEIR SUPPLIERS AND/OR LICENSORS); OR • ALTERING THE TERMS AND CONDITIONS OF THE APPLICABLE LICENSE AGREEMENT GOVERNING THE USE OF ROCKET SOFTWARE. ©2015 Rocket Software, Inc. All Rights Reserved.
  • 38. 39 Trademarks and Acknowledgements The trademarks and service marks identified in the following list are the exclusive properties of Rocket Software, Inc. and its subsidiaries (collectively, “Rocket Software”). These marks are registered with the U.S. Patent and Trademark Office, and may be registered or pending registration in other countries. Not all trademarks owned by Rocket Software are listed. The absence of a mark from this page neither constitutes a waiver of any intellectual property rights that Rocket Software has established in its marks nor means that Rocket Software is not owner of any such marks. Aldon, CorVu, Dynamic Connect, D3, FlashConnect, Pick, mvBase, MvEnterprise, NetCure, Rocket, SystemBuilder, U2, U2 Web Development Environment, UniData, UniVerse, and wIntegrate Other company, product, and service names mentioned herein may be trademarks or service marks of others. ©2015 Rocket Software, Inc. All Rights Reserved.
  • 39. 40