Return to site

🧩🧾 JSON-P & JSON-B: READ/WRITE JSON IN JAVA

January 24, 2026

🔸 TL;DR 🧠

▪️ JSON-P Model API = build/parse JSON trees 🌳

▪️ JSON-P Streaming API = process huge JSON efficiently 🌊

▪️ JSON Pointer = access nested values with a path 🎯

▪️ JSON Patch = apply structured JSON updates 🩹

▪️ JSON-B = clean POJO mapping (JSON ↔ Java) 🔁

🔸 QUICK NOTE (WHY PACKAGES CHANGED) 🔁

▪️ In Jakarta EE 9+, the APIs moved from javax.* ➜ jakarta.* (same concepts, new namespace) ✅

🔸 JSON-P “TREE” STYLE: BUILD + READ JSON WITH THE MODEL API 🌳

▪️ Create JSON programmatically:

▪️ Parse JSON into a tree:

🔸 JSON-P “STREAMING” STYLE: FAST + LOW MEMORY FOR BIG JSON 🌊

▪️ Write JSON as a stream:

▪️ Parse JSON token by token:

🔸 JSON POINTER: TARGET A SPECIFIC VALUE 🎯

🔸 JSON PATCH: APPLY “OPERATIONS” TO MODIFY JSON 🩹

🔸 JSON-B: JSON ↔ POJOS (THE “MAPPER” WAY) 🔁

▪️ JSON → Java objects:

▪️ Java objects → JSON string:

🔸 TAKEAWAYS ✅

▪️ Pick JSON-B for most “business JSON ↔ POJOs” use cases

▪️ Pick JSON-P Streaming when performance/memory matters

▪️ Use Pointer + Patch for surgical JSON edits (great for REST partial updates)

▪️ Mixing JSON-P + JSON-B is totally fine in real projects 🛠️

#Java #JakartaEE #JSON #JSONP #JSONB #Backend #APIs #SoftwareEngineering #Programming #CleanCode

Go further with Java certification:

Java👇

https://www.udemy.com/course/ocp-oracle-certified-professional-java-developer-prep/?referralCode=54114F9AD41F127CB99A

Spring👇

https://www.udemy.com/course/spring-professional-certification-6-full-tests-2v0-7222-a/?referralCode=04B6ED315B27753236AC

SpringBook👇

https://bit.ly/springtify

JavaBook👇

https://bit.ly/jroadmap