Wednesday, March 30, 2022

How to Read JSON String in Java using json-simple library? Example Tutorial

Hello guys, if you are wondering how to read JSON in Java using the json-simple library and looking for an example then you have come to the right place. Earlier, I have shown you how to parse JSON using Jackson and how to read JSON using the Gson library in Java, and today, I am going to share how to read JSON strings using json-simple, another popular JSON library in Java. If you don't know, JSON is a text format that is widely used as a data-interchange language because its parsing and its generation are easy for programs. It is slowly replacing XML as the most powerful data interchange format, as it is lightweight, consumes less bandwidth, and is also platform-independent.  

Saturday, March 26, 2022

How to send JSON via POST request using RestTemplate in Spring | PostForObject, PostForEntity, and PostLocation Example in Java

Hello guys, if you are wondering how to send a Post request with Json in Java application using Spring framework then you have come to the right place. Earlier, I have shown how to consume JSON from a RESTful API and In this tutorial, we are going to discuss how to send POST requests via RestTemplate in JSON. We will have an example project which is having POST API and then test it by sending request body along with request headers using postEntry(). POST requests can be made using the RestTemplate class's postForObject(), postForEntity(), and postForLocation() template methods. The first two techniques are fairly similar to what I covered in the GET request lesson for RestTemplate. Instead of returning the whole resource, the last method returns the location of the newly formed resource.

Wednesday, March 16, 2022

Spring Boot + Redis Example in Java

Hello guys, if you are wondering how to use Redis with Spring Boot in Java then you have come to the right place. Earlier, I have shared the Spring Boot + React example, Spring Boot + Angular example, and Spring Boot + MyBatis examples In this tutorial, we will review the basics of how to use Redis with Spring Boot. We will build an application that demonstrates how to perform CRUD operations Redis through a web interface. So before going into in detailed project example, let's move with the what is spring Redis. As Java developers, we need to talk about the data layer, as we can't develop an insightful application without the use of CRUD operations.