SlideShare a Scribd company logo
Blah blah
Blah blah
Blah blah
Blah blah !!!!#$!
App Store 2008:
-connected apps, showing real
time data! Whoa Nelly!
- in your pocket! Boom!
Communication OK?
XML? CSV? binary?
<myverylongtagname>
1
</myverylongtagname>
MyName, 1, 2, 5, left, TRUE
Other, 5, 4, 3, left, FALSE
0100001001100101001000
0001110011011101010111
0010011001010010000001
110100011011110
JSON
JSON is awesome
1) it’s very SIMPLE!
2) supported by tons of languages
3) structural data
• Step1: Stackoverflow
• Step2: click the link in approved answer
• Step3:
•
How to JSON?
Simplest approach
[[[[[json objectForKey:@”name”] objectAtIndex:1]
objectAtIndex: 2] objectForKey:@”value”] boolValue]
2009 code
2013 code
[json[@”name”][1][2][@”value”] boolValue]
never!
- json ... is nil ...
- EXC_BAD_ACCESS
- ... unrecognized selector ... [NSString boolValue]
- ... index out of bounds ...
Pros & Cons
• very quick code turnaround!!!
• no structure validation
• no data validation
• difficult to error handle
• it’s the road to maintenance
HELL!
evolution indicator
A better way!
NSDictionary* json = [NSJSONSerialization ... ];
if (json == nil) [self errorHandleEmptyJSON];
if (json[@”name”] == nil)
[self errorHandleEmptyName];
NSArray* name = json[@”name”];
if (name.count<1]
[self errorHandleWrongJSONStructure];
NSNumber* value = name[1][2][@”value”];
Forget much? oh noes...
Looks good so far, what’s left?
- validate the data for all values you use
- check if the incoming objects are of the
expected class type (yuicks!)
- make sure you decend into the JSON
according to the incoming structure
Pros & cons?
• Horribly slow to write code
• Difficult to maintain
• How do you recover from errors
in the middle of the parsing process???
• Better data validation
• Better structure validation
evolution indicator
Data models?
The “M” in MVC stands
for “MODEL”
Wrap up all the code in
classes for all your models
feels good!
Your models feature custom init
which reads the JSON and builds
up the model representation
All IF statements and all the error
handling is handled within the
model class
Other magic you coded at 4.17am on a Thursday
Pros & cons
• Using a class instead of NSDictionary
• OOP 4 Ever!
• Very flexible code
• Lot of redundant parsing code
• Lot of implementation
• Still harder to adapt to changes
evolution indicator
Then what?
Throughout 2012 I worked
mainly on JSON powered
applications.
In December I was already
fed-up with:
self.name = json[@”name”];
Eureka!
JSONModel
- import JSON
- structure validation
- data type validation
- data type conversion
- atomic operations
- error handling
Automatically does/has:
Import JSON
.h .m
For relatively simple models eliminates
the need to code in your .m file
Validation
@property (strong, nonatomic) NSString* name;
What you want is:
What you should be
getting might be:
{“name”:“Name”}
It is about what you want to have!
Conversion
@property (strong, nonatomic) NSURL* blogSiteUrl;
What you want is:
What you get is:
{“blogSiteUrl”:“http://www.yahoo.com”}
It is about what you want to have!
JSONModel
evolution indicator
Takes the hum-drum out of
coding
It’s very fast
Growing (testing) fan base
Thanks
www.JSONModel.com
Image credits:
http://www.clker.com
http://clipart.christiansunite.com
http://office.microsoft.com

More Related Content

PDF
Everyday Functional Programming in JavaScript
PDF
Inside3DPrinting_johnhornick
PDF
How Ecosystem Economics™ Predicts the Winners in the Digital Age
PDF
What is VO2Max
PDF
FSP Network Hypervisor: Optical Network Virtualization for SDN
PPTX
Digital Shoring for Networked Innovation
PPTX
techMAP Amsterdam: Thoughts on the Mobile Wallet
PDF
Mobile Payments & NFC World Summit 2012
Everyday Functional Programming in JavaScript
Inside3DPrinting_johnhornick
How Ecosystem Economics™ Predicts the Winners in the Digital Age
What is VO2Max
FSP Network Hypervisor: Optical Network Virtualization for SDN
Digital Shoring for Networked Innovation
techMAP Amsterdam: Thoughts on the Mobile Wallet
Mobile Payments & NFC World Summit 2012

Viewers also liked (19)

PPTX
Some Successful Rabo Development Projects : Focus on Mobile
PPTX
Mobile Financial Services - IBC / Singapore
PPTX
Mobile Financial Services Distribution: Partnerships, Alliances & Joint-Ventures
PPTX
Mobile Banking & Rabo Development Partner Banks
PPTX
Mobile Convention Amsterdam - 22 May 2013
PPTX
Future of Web 2.0 - talk, 22 September 2009
PDF
Rabo Development Retail Distribution & Channel Strategies & Successes
PPTX
Banking Distribution Overview
PPTX
M-Commerce World Summit 2011 - Introduction
PPTX
Rabo Mobiel & NMB Mobile: Mobile Banking & Payments Development
PPTX
techMAP Amsterdam: What's trending in 2012? A focus on SOLOMO
PPTX
The Consumer Side of NFC and Mobile Payments
PDF
Mobey Forum - Case Study: Banking the Banked with NMB Mobile
PPTX
Mobile Banking & Payments Update: September 2010
PDF
BPR Mobile Banking
PPTX
Rabo Development & Sustainable Distribution
PPTX
Rabo Development Retail Distribution Case Study: Mobile Banking and Payments
PPTX
Africa - Mobile Convention Amsterdam
PPTX
Mobile Payments & Banking - NACHA Global Payments Forum
Some Successful Rabo Development Projects : Focus on Mobile
Mobile Financial Services - IBC / Singapore
Mobile Financial Services Distribution: Partnerships, Alliances & Joint-Ventures
Mobile Banking & Rabo Development Partner Banks
Mobile Convention Amsterdam - 22 May 2013
Future of Web 2.0 - talk, 22 September 2009
Rabo Development Retail Distribution & Channel Strategies & Successes
Banking Distribution Overview
M-Commerce World Summit 2011 - Introduction
Rabo Mobiel & NMB Mobile: Mobile Banking & Payments Development
techMAP Amsterdam: What's trending in 2012? A focus on SOLOMO
The Consumer Side of NFC and Mobile Payments
Mobey Forum - Case Study: Banking the Banked with NMB Mobile
Mobile Banking & Payments Update: September 2010
BPR Mobile Banking
Rabo Development & Sustainable Distribution
Rabo Development Retail Distribution Case Study: Mobile Banking and Payments
Africa - Mobile Convention Amsterdam
Mobile Payments & Banking - NACHA Global Payments Forum
Ad

Similar to JSONModel Lightning Talk (20)

PPTX
Battle of The Mocking Frameworks
PPTX
GCSECS-DefensiveDesign.pptx
PDF
Dutch PHP Conference 2015 - The quest for global design principles
PDF
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
PPTX
Generative Testing in Clojure
PPTX
2011 - SharePoint + jQuery
PDF
Down With JavaScript!
PDF
Jest: Frontend Testing richtig gemacht @WebworkerNRW
PDF
Core Data in RubyMotion #inspect
PDF
Managing and evolving JavaScript Code
PDF
Test Driven Development - Workshop
PPTX
SQL Server 2016 JSON
PDF
Java EE 7 from an HTML5 Perspective, JavaLand 2015
PPTX
How to build a SaaS solution in 60 days
PPTX
Breaking the Oracle Tie; High Performance OLTP and Analytics Using MongoDB
PDF
Writing enterprise software error checking
PDF
Using MLOps to Bring ML to Production/The Promise of MLOps
PPTX
Dapper: the microORM that will change your life
PDF
John Resig Beijing 2010 (English Version)
PPTX
Mariia Havrylovych "Active learning and weak supervision in NLP projects"
Battle of The Mocking Frameworks
GCSECS-DefensiveDesign.pptx
Dutch PHP Conference 2015 - The quest for global design principles
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
Generative Testing in Clojure
2011 - SharePoint + jQuery
Down With JavaScript!
Jest: Frontend Testing richtig gemacht @WebworkerNRW
Core Data in RubyMotion #inspect
Managing and evolving JavaScript Code
Test Driven Development - Workshop
SQL Server 2016 JSON
Java EE 7 from an HTML5 Perspective, JavaLand 2015
How to build a SaaS solution in 60 days
Breaking the Oracle Tie; High Performance OLTP and Analytics Using MongoDB
Writing enterprise software error checking
Using MLOps to Bring ML to Production/The Promise of MLOps
Dapper: the microORM that will change your life
John Resig Beijing 2010 (English Version)
Mariia Havrylovych "Active learning and weak supervision in NLP projects"
Ad

Recently uploaded (20)

PDF
Approach and Philosophy of On baking technology
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Electronic commerce courselecture one. Pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
Approach and Philosophy of On baking technology
“AI and Expert System Decision Support & Business Intelligence Systems”
Dropbox Q2 2025 Financial Results & Investor Presentation
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
Electronic commerce courselecture one. Pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Mobile App Security Testing_ A Comprehensive Guide.pdf
Programs and apps: productivity, graphics, security and other tools
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Per capita expenditure prediction using model stacking based on satellite ima...
Digital-Transformation-Roadmap-for-Companies.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
The AUB Centre for AI in Media Proposal.docx
Chapter 3 Spatial Domain Image Processing.pdf
Machine learning based COVID-19 study performance prediction
Unlocking AI with Model Context Protocol (MCP)
Diabetes mellitus diagnosis method based random forest with bat algorithm

JSONModel Lightning Talk

  • 1. Blah blah Blah blah Blah blah Blah blah !!!!#$! App Store 2008: -connected apps, showing real time data! Whoa Nelly! - in your pocket! Boom!
  • 2. Communication OK? XML? CSV? binary? <myverylongtagname> 1 </myverylongtagname> MyName, 1, 2, 5, left, TRUE Other, 5, 4, 3, left, FALSE 0100001001100101001000 0001110011011101010111 0010011001010010000001 110100011011110 JSON
  • 3. JSON is awesome 1) it’s very SIMPLE! 2) supported by tons of languages 3) structural data
  • 4. • Step1: Stackoverflow • Step2: click the link in approved answer • Step3: • How to JSON?
  • 5. Simplest approach [[[[[json objectForKey:@”name”] objectAtIndex:1] objectAtIndex: 2] objectForKey:@”value”] boolValue] 2009 code 2013 code [json[@”name”][1][2][@”value”] boolValue]
  • 6. never! - json ... is nil ... - EXC_BAD_ACCESS - ... unrecognized selector ... [NSString boolValue] - ... index out of bounds ...
  • 7. Pros & Cons • very quick code turnaround!!! • no structure validation • no data validation • difficult to error handle • it’s the road to maintenance HELL! evolution indicator
  • 8. A better way! NSDictionary* json = [NSJSONSerialization ... ]; if (json == nil) [self errorHandleEmptyJSON]; if (json[@”name”] == nil) [self errorHandleEmptyName]; NSArray* name = json[@”name”]; if (name.count<1] [self errorHandleWrongJSONStructure]; NSNumber* value = name[1][2][@”value”];
  • 9. Forget much? oh noes... Looks good so far, what’s left? - validate the data for all values you use - check if the incoming objects are of the expected class type (yuicks!) - make sure you decend into the JSON according to the incoming structure
  • 10. Pros & cons? • Horribly slow to write code • Difficult to maintain • How do you recover from errors in the middle of the parsing process??? • Better data validation • Better structure validation evolution indicator
  • 11. Data models? The “M” in MVC stands for “MODEL” Wrap up all the code in classes for all your models
  • 12. feels good! Your models feature custom init which reads the JSON and builds up the model representation All IF statements and all the error handling is handled within the model class Other magic you coded at 4.17am on a Thursday
  • 13. Pros & cons • Using a class instead of NSDictionary • OOP 4 Ever! • Very flexible code • Lot of redundant parsing code • Lot of implementation • Still harder to adapt to changes evolution indicator
  • 14. Then what? Throughout 2012 I worked mainly on JSON powered applications. In December I was already fed-up with: self.name = json[@”name”]; Eureka!
  • 15. JSONModel - import JSON - structure validation - data type validation - data type conversion - atomic operations - error handling Automatically does/has:
  • 16. Import JSON .h .m For relatively simple models eliminates the need to code in your .m file
  • 17. Validation @property (strong, nonatomic) NSString* name; What you want is: What you should be getting might be: {“name”:“Name”} It is about what you want to have!
  • 18. Conversion @property (strong, nonatomic) NSURL* blogSiteUrl; What you want is: What you get is: {“blogSiteUrl”:“http://www.yahoo.com”} It is about what you want to have!
  • 19. JSONModel evolution indicator Takes the hum-drum out of coding It’s very fast Growing (testing) fan base