Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
JSON API - standards please
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Michal Ostruszka
January 14, 2014
Programming
270
2
Share
JSON API - standards please
Slides from my Meet.JS talk on JSON API standards (JSend and JSON API specifications)
Michal Ostruszka
January 14, 2014
More Decks by Michal Ostruszka
See All by Michal Ostruszka
Building modern web applications. Single Responsibility Principle applied
mostr
2
430
Building modern web applications. Single Responsibility Principle applied
mostr
4
160
You don't need Rails
mostr
3
180
Backendless frontend development
mostr
2
320
Code review, do you speak it?
mostr
0
560
Things you probably should know about JavaScript that you may not have been told before
mostr
6
710
Other Decks in Programming
See All in Programming
Coding at the Speed of Thought: The New Era of Symfony Docker
dunglas
0
5k
Vibe하게 만드는 Flutter GenUI App With ADK , 박제창, BWAI Incheon 2026
itsmedreamwalker
0
550
「Linuxサーバー構築標準教科書」を読んでみた #ツナギメオフライン.7
akase244
0
1.4k
AIベース静的検査器の偽陽性率を抑える工夫3選
orgachem
PRO
3
340
運転動画を検索可能にする〜Cosmos-Embed1とDatabricks Vector Searchで〜/cosmos-embed1-databricks-vector-search
studio_graph
0
390
AWS re:Invent 2025の少し振り返り + DevOps AgentとBacklogを連携させてみた
satoshi256kbyte
3
170
Claude CodeでETLジョブ実行テストを自動化してみた
yoshikikasama
0
450
Lightning-Fast Method Calls with Ruby 4.1 ZJIT / RubyKaigi 2026
k0kubun
3
980
瑠璃の宝石に学ぶ技術の声の聴き方 / 【劇場版】アニメから得た学びを発表会2026 #エンジニアニメ
mazrean
0
270
Claude Code × Gemini × Ebitengine ゲーム制作素人WebエンジニアがGoでゲームを作った話
webzawa
0
150
Surviving Black Friday: 329 billion requests with Falcon!
ioquatix
0
730
ドメインイベントでビジネスロジックを解きほぐす #phpcon_odawara
kajitack
3
790
Featured
See All Featured
Chasing Engaging Ingredients in Design
codingconduct
0
170
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
23k
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
180
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
69
39k
Building an army of robots
kneath
306
46k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
340
Paper Plane (Part 1)
katiecoart
PRO
0
6.7k
We Have a Design System, Now What?
morganepeng
55
8.1k
Mobile First: as difficult as doing things right
swwweet
225
10k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.2k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
520
Transcript
JSON API standards please Michał Ostruszka | @mostruszka | michalostruszka.pl
every app defines own “standard” Wild, wild west
{ “status”: “ok”, “response”: {...} }
{ “result”: “success”, “data”: [] }
{ “status”: 200 }
{ “result”: “error”, “msg”: “No such user” }
{ “status”: 404, “error”: “No such user” }
{ “status”: 404, “errors”: [ “No such user” ] }
and so on...
sometimes even within one app Inconsistency
Any standards?
“JSend is a specification that lays down some rules for
how JSON responses from web servers should be formatted” JSend
JSend - success { “status”: “success”, “data”: { “posts”: [...]
} } required: status, data
JSend - failure { “status”: “fail”, “data”: { “title”: “Title
is required” } } Used for invalid data responses required: status = “fail”, data
JSend - error { “status”: “error”, “message”: “Server goes bananas”
} Used for server errors required: status = “error”, message optional: code, data
simple easy to follow, “data” can contain anything That’s all
only 41 various interpretations not always flexible enough Wait, HTTP
codes?
“If you've ever argued with your team about the way
your JSON responses should be formatted, JSON API is your anti-bikeshedding weapon.” JSON API
defines data format, mime type registered application/vnd.api+json relations etc Bigger
spec
ID style URL style Flavors
JSON API - Simple { “posts”: [{ “id”: 1, “title”:
“Hello world” }] } always as list, even for 1 item item MUST contain “id”
JSON API - Relationships { “posts”: [{ “id”: 1, “title”:
“Hello world”, “links”: { “author”: “9” “comments”: [“1”,”2”,”3”] } }] } Client needs to know how to build author url
Embedded in “linked” field Save HTTP requests Compound docs
Same for simple resources URL Style
URL Style { “posts”: [{ “id”: 1, “title”: “Hello world”,
“links”: { “author”: “http://example.com/author/2” } }] } client can blindly follow URLs
GET /posts/1?include=comments GET /posts/1?include=comments.author Selective fetching
Defines how to send data POST, PUT, DELETE etc Resources
manipulation
No status in response body HTTP codes used to determine
status Relies on HTTP codes
Once JSON API is stable, it will always be backwards
compatible using a never remove, only add strategy Changes?
http://labs.omniti.com/labs/jsend http://jsonapi.org/ Where to find?
Possible adoption? Stick to standard for your project JSend looks
easier Final word
kthxbye