
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 208 Articles for JSON

2K+ Views
JSON is a format that is used to exchange data between a server and a client. It is lightweight and easy to read and write. In Java, we can convert JSON to/from Map using various libraries. In this article, we will discuss how to convert JSON to/from Map using the Jackson library. The Jackson is a library for Java, and it has very powerful data binding capabilities and provides a framework to serialize custom java objects to JSON and deserialize JSON back to Java object. We can convert JSON to/from Map using readValue() and writeValueAsString() methods of com.fasterxml.jackson.databind.ObjectMapper class. To ... Read More

6K+ Views
JSON is a lightweight data interchange format. It is mostly used in web applications for sending and receiving data. To know more about JSON, refer JSON. A JSON array is a collection of JSON objects. It is similar to a list in Java. CSV is the format for storing tabular data in plain text. It is a comma-separated value. It is used for data exchange between applications. Let's see how CSV format looks like: JSON array The following is an example of the JSON array: [ { "Name": "Ansh", ... Read More

4K+ Views
JSON is a data interchange format that is easy to read and write. It is lightweight and gets parsed easily. It is commonly used in web applications for sending and receiving data. To know more about JSON, refer to JSON. Pretty print is a type of formatting that formats data in a more easily readable way by adding indentation and line breaks. It is useful for debugging and logging purposes. Enabling pretty print Using Gson Library Gson is a JSON library for Java, which was created by Google. By using Gson, we can generate JSON and convert JSON to Java objects. ... Read More

4K+ Views
Converting a map to a JSON object is our task here. Let's see how to convert a map to a JSON object in Java using the Gson library. Converting a Map to JSON using the Gson library JSON is a simple and lightweight data interchange format. It stores data in key-value pairs. A map is also a collection of key-value pairs. So, we can easily convert a map to a JSON object. If you are not familiar with JSON, refer JSON. And if you want to know more about Map, refer Map. Gson is developed by Google. It is an ... Read More

8K+ Views
In this article, we will be discussing how to convert a list of objects to JSON using the Gson library in Java. JSON is an interchangeable format that is used for data exchange. Values in JSON are represented as key-value pairs. To know more about JSON, refer JSON. Java GSON Library: Converting a list of objects to JSON Gson is a third-party Java library developed by Google. It is used for converting Java objects to JSON and vice versa. In the Gson library, we can convert a list of objects to JSON using the toJson() method. We cannot use the ... Read More

9K+ Views
Let's see learn how to change a JSON object into a Java object using the Gson library. Gson is a tool made by Google for converting Java objects into JSON and back. JSON stands for JavaScript Object Notation. In the JSON format, data is stored in key-value pairs. Mainly, it is used for sharing data between a server and a web app. Gson is a Java tool that can turn Java objects into JSON and JSON back into Java objects. It is used by many developers because it is simple and easy. Why Convert JSON Object to Java Object? Here ... Read More

11K+ Views
In this article, let's learn how to check if a JSON object has any values or not in Java. If you don't know about JSON, refer JSON. We will use the org.json library and its methods like isEmpty(), length(), and keys() to check if a JSON object is empty or not. We can check if a JSON object is empty or not using the following methods: Using isEmpty() method Using length() method Using keys() method Let's see how to use each of them one by one. ... Read More

31K+ Views
We often need to extract values from a JSON object. In this article, we will learn how to get the values of the different types from a JSON object in Java. What is JSONObject? Java JSONObject is a class in the org.json package that represents a JSON object. Refer JSONObject for more information. Let's see the steps to get the values of different types from a JSON object in Java. Getting different values from a JSON object Before we start, let's add the required library to our program. We can add a .jar file, or we can use a Maven ... Read More

527 Views
A JSONStringer provides a convenient way of producing JSON text, and it can strictly follow to JSON syntax rules. Each instance of JSONStringer can produce one JSON text. A JSONStringer instance provides a value method for appending values to the text and a key-method for adding keys before values in objects. We have array () and endArray() methods that create and bind array values, and object() and endObject () methods that create and bind object values. It is part of the org.json library. It is generally used in Android and lightweight Java programs. In this article, we will learn when to use a JSONStringer in Java. When to use ... Read More

9K+ Views
In this article, we will learn how to sort a JSON array in Java. But first, let’s understand what JSON is. If you do not have knowledge about JSON, you can refer to the tutorial JSON Overview. Now, let's see different ways to sort a JSON array in Java. Ways to sort a JSON array in Java Following are different ways to sort a JSON array in Java - Sort JSON array Without any Dependency Using org.json library: Methods are getJSONArray() and getJSONObject() Using Gson library: Methods ... Read More