Working with JSON Arrays using Jakarta JSON API

JSON arrays are a fundamental data structure in JSON, used to store collections of values or objects. Java provides the JsonArray and JsonArrayBuilder classes from the Jakarta JSON API to efficiently create, manipulate, and parse JSON arrays. It also provides methods to parse a JSON Array into a Java Collection. In this tutorial we will see both options with practical examples

Read more

JSON pretty printing in Java

When working with JSON data, readability matters. JSON pretty printing is a technique used to format JSON data in a human-readable manner, making it easier to analyze, debug, and understand. In this tutorial, we’ll explore how to perform JSON pretty printing in Java, leveraging libraries to format JSON for improved readability.

Read more

How to parse JSON in Java

In today’s data-driven world, the ability to effectively parse and process JSON data has become an essential skill for Java developers. This tutorial will guide you through the fundamentals of parsing JSON data using the Jakarta JSON API framework which includes two main models: JSON Processing (JSON-P) and JSON Binding (JSON-B). Binding and Processing JSON … Read more

How to filter a JSON Document using Java Stream API

Filtering through a JSON document using Java 8 Stream API involves converting the JSON document into a stream of objects and then using the filter method to select the objects that match a given condition. Here are the steps to filter through a JSON document using Java 8 Stream API.

Read more

Comparing Jackson vs JSONB

JSON-B and Jackson are both libraries that can be used for parsing and generating JSON data in Java. However, they have some differences in their functionality and usage. This tutorial will discuss them in detail.

Read more

How to use JSON-P to create and parse JSON in Java

This tutorial shows how to use JSON Processing (JSR-353) API, part of the Jakarta EE specification. In general terms, there are two main APIs to handle JSON in Java: JSON-P (JSON-Processing, JSR 374): Specifies a very low-level processing library which can be carried out with two models for JSON processing: the Object Model API and the Streaming … Read more

How to navigate and edit a JSON Document with JSON Pointer API

This tutorial will teach you how to navigate or modify a JSON Document using a JSON Pointer, which is available in javax.json API. Put it simply, a JSON Pointer is a string that references an element within a JSON document. By using a JSON pointer, an application can retrieve a value, but it can modify … Read more

How to use JSON-B for parsing Java objects to/from JSON

In this tutorial we will learn about JSON-B, which is a standard binding layer for converting Java objects to/from JSON messages, included as part of JSR 367 Specification (Java EE 8). In general terms, there are two main APIs to handle JSON in Java: JSON-P (JSON-Processing, JSR 374): Specifies a very low-level processing library which … Read more