How to filter a JSON Document using Java Stream API

Working with JSON is a daily task in modern Java applications. Thanks to the Java 8 Stream API and the Jackson library, you can now process JSON data in a clean, functional style. Instead of writing verbose loops and conditionals, you can compose readable pipelines that handle filtering, mapping, and collecting with ease.

In this tutorial, we’ll walk through how to parse a JSON document and apply powerful filters using Java Streams. We’ll also cover best practices for Java 11+ and performance tips for handling large datasets.

Read more

How to process large JSON files in Java

Processing large JSON files can be challenging due to memory constraints and performance issues. In this tutorial, we explore best practices for efficiently handling large JSON files in Java. Why Handle Large JSON Files Efficiently? Large JSON files can quickly exhaust memory and slow down applications if processed naïvely. By employing streaming APIs and other … Read more

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

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