Aishwarya Naglot has Published 180 Articles

When can we use a JSONStringer in Java?

Aishwarya Naglot

Aishwarya Naglot

Updated on 22-Apr-2025 14:33:12

519 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 ... Read More

How can we convert a list to the JSON array in Java?

Aishwarya Naglot

Aishwarya Naglot

Updated on 22-Apr-2025 14:25:07

33K+ Views

Converting a list to a JSON array is one of the common tasks in Java. Let's see how to convert a list to a JSON array in Java. If you do not know what JSON is, then you can read the JSON tutorial. The following are various ways to convert ... Read More

Convert JSON object to Java object using Gson library in Java?

Aishwarya Naglot

Aishwarya Naglot

Updated on 22-Apr-2025 14:24:14

8K+ 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 ... Read More

How to pretty print JSON using the Gson library in Java?

Aishwarya Naglot

Aishwarya Naglot

Updated on 22-Apr-2025 12:30:39

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 ... Read More

Convert a JSON String to Java Object using the json-simple library in Java?

Aishwarya Naglot

Aishwarya Naglot

Updated on 21-Apr-2025 19:35:29

2K+ Views

In this article, we will learn how to convert a JSON string to a Java object using the json.simple library. JSON stands for JavaScript Object Notation. It's a simple format that stores data in key-value pairs. It is used for sharing data between a server and a web app. To ... Read More

How to construct a JSON object from a subset of another JSON object in Java?

Aishwarya Naglot

Aishwarya Naglot

Updated on 21-Apr-2025 19:33:12

3K+ Views

In this article, we will learn how to construct a JSON object from a subset of another JSON object in Java. If you are not familiar with JSON and its usage in Java, you can refer to our JSON Overview tutorial. JSON Object From a Subset of Another Object There ... Read More

Difference Between LinkedList and LinkedHashSet in Java

Aishwarya Naglot

Aishwarya Naglot

Updated on 21-Apr-2025 19:15:46

2K+ Views

LinkedList and LinkedHashSet are two important classes of Java's Collection framework. They are used to store groups of items, but they work in different ways and have their own unique features. What is a LinkedList in Java? Java LinkedList is a linear data structure that is used to store the ... Read More

Convert a JSON object to XML format in Java?

Aishwarya Naglot

Aishwarya Naglot

Updated on 21-Apr-2025 18:54:40

7K+ Views

In this article, we will learn how to convert a JSON object into XML format in Java. But first, let’s understand what JSON and XML are. JSON is a lightweight data-interchange format, and the format of JSON is like a key-value pair. XML (Extensible Markup Language) is also a ... Read More

Sorting a vector in descending order in C++

Aishwarya Naglot

Aishwarya Naglot

Updated on 22-Nov-2024 11:21:24

18K+ Views

In C++, sorting a vector is a common task, and many problems are based on sorting. To sort a vector in descending order, we can use the std::sort() function from the STL (Standard Template Library). This function is included in the ... Read More

How to read the contents of a JSON file using Java?

Aishwarya Naglot

Aishwarya Naglot

Updated on 20-Nov-2024 15:20:27

10K+ Views

JSON or JavaScript Object Notation is a lightweight text-based open standard designed for human-readable data interchange. Conventions used by JSON are known to programmers and include C, C++, Java, Python, Perl, etc. Sample JSON document − { "book": [ ... Read More

Advertisements