JSON is one of the most widely used human-readable data interchange formats in the world. This course will teach you how to generate and parse JSON, what it can and should be used for and how to integrate it into other projects.
JSON is one of the most widely used human-readable data interchange formats in the world and understanding how it works is important for developing server-side Java applications. In this course, Java: JSON Fundamentals, you will learn everything about JSON that a Java developer needs to know. First, you will cover what it can and should be used for. Next, you will learn how to generate and parse JSON including binding, streaming and DOM/Tree style APIs. Finally, we will look at the big picture of JSON: how to integrate it into projects and appropriate information architecture principles. When you've finished this course, you will have a strong understanding of how JSON can be used in real-world server-side Java projects.
Course Overview Hi everyone. My name is Richard Warburton, and welcome to my course Java: JSON Fundamentals. I'm an independent software consultant and co-founder of Opsian. com, a low overhead production profiling solution. JSON is one of the most popular formats for serializing data into and is really commonly used by Java programmers, especially for talking to front-end web applications. Some of the major topics you'll learn about in this course are as follows, what JSON is used for in the context of Java application, how to take Java objects and produce JSON documents from them in an easy and maintainable manner, how to consume JSON documents and ingest them into Java objects, what are the best practices of information architecture for using JSON with Java. By the end of this course, you'll know how to use JSON in real-world Java applications and be really productive with it. Before beginning the course, you only need to be familiar with core Java programming techniques. No familiarity with JSON is assumed. I hope you'll join me on this journey to learn JSON with the Java: JSON Fundamentals course at Pluralsight.
Producing JSON Hello, and welcome to module 2 of the course. In module 1, we looked at what JSON was and why you might want to use it. In this module, we're going to progress to producing JSON, i. e. taking data from Java objects and producing serialized JSON data out of them. Now, like everything in life, there are many ways of producing JSON. No one way is perfect for all situations, and some are never a good idea. The first approach you'll encounter, which is a bit of an anti-pattern really is the manual manufacture of JSON. So we're going to do some string concatenation, some formatting, and we're going to produce some JSON strings. Now I'm showing you this so you can see why it isn't a very good approach. Then, you'll learn about the generator API. This is a light-weight API for producing JSON documents. It's very simple to get started with, but it still leaves you with a lot of work to do and some ongoing maintenance burden. Finally, we'll take a binding API approach. The binding API approach is one that will automatically serialize your Java objects into JSON. So there's a really simple API that takes a lot of the work out of producing JSON.
Consuming JSON with a DOM API Hello. I'm Richard Warburton, and welcome to module 3. This is entitled Consuming JSON with a DOM API. This is the first of three consecutive modules where we start talking about how we consume or parse, as it's sometimes referred to, JSON. So that's going from having data encoded as a string on a connection or in a file to having it in-memory in your Java application. We'll proceed in three parts. First, you'll get to learn about what we mean by a DOM API and why you want to use an API rather than hand write a JSON parser. Then, I'll live code with some Jackson demos. That way you'll get to see what the API is like in practice and understand how to use it. Finally, we'll talk about situations where you want to use a DOM API rather than the other two styles for parsing JSON.
Consuming JSON with a Binding API Hi there, and welcome to module 4 of this course. In this module, we're going to talk about the simplest and most commonly used way of consuming JSON documents in Java. And that's using a binding API. So, we've looked at how you consume JSON with a DOM API in the previous module. That was a document object model API. That worked fine, so what was the problem that existed there that we solve using a binding API? Now, the idiomatic Java approach to modeling a domain event or a message is to use a POJO. That stands for plain old Java object. Java classes that define POJOs will just store their property values and fields, and each field will have a getter and a setter with the same naming convention as the field. As a Java dev, you're probably pretty familiar with this idea by now. Using a POJO to store values in the field also ends up encoding the same structure as a JSON object. JSON properties are storing the same information with a different convention as the Java field plus getter and setter approach. If you're using a DOM API for JSON and converting that to a POJO, then you're inevitably going to have to write a lot of boilerplate code, which is just extracting these values from the JSON and setting them into the POJO with the same name. This is time consuming, tedious, and error prone to write. A binding style API takes the approach of auto-generating this mapping code from the structure of the POJO object. So you just ask for JSON to be converted into a POJO and it does it for you.
JSON Information Architecture Welcome to the penultimate module of this course, Information Architecture. This is a module that isn't just about the Java APIs for producing and consuming JSON, but more overarching concerns. In order to understand why this module is important, it's worth taking a moment to understand what information architecture is. This is about the big picture design of how we lay out our data in JSON documents. In this module, we're going to look at a series of principles related to JSON that help us write easier to maintain applications and systems.