- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Raja has Published 760 Articles
raja
1K+ Views
A Gson library provides a way to specify custom serializers by registering a custom serializer with the GsonBuilder if we need a way to convert a java object to JSON. We can create a custom serializer by overriding the serialize() method of com.google.gson.JsonSerializer class.In the below example, the implementation of custom serialization of JSON.Exampleimport ... Read More
raja
4K+ Views
A JSONObject can parse text from a String to produce a map-like object and a JSONArray can parse text from a String to produce a vector-like object. We can also add a JSONArray within JSONObject by first creating a JSONArray with few items and add these array of items to the put() ... Read More
raja
6K+ Views
A JSON is a lightweight data-interchange format and the format of JSON is like a key-value pair. We can convert XML to JSON array using org.json.XML class, this provides a static method, XML.toJSONObject() to convert XML to JSON array.Syntaxpublic static JSONObject toJSONObject(java.lang.String string) throws JSONExceptionIn the below example, converting XML to JSON arrayExampleimport ... Read More
raja
1K+ Views
A Gson is a library that can be used to convert Java Objects to JSON representation. The primary class to use is Gson which we can create by calling the new Gson() and the GsonBuilder class can be used to create a Gson instance.We can write a JSON string to file using ... Read More
raja
3K+ Views
A Gson is a library that can be used to parse Java objects to JSON and vice-versa. It can also be used to convert a JSON string to an equivalent Java object. In order to parse java object to JSON or JSON to java object, we need to import com.google.gson package in the ... Read More
raja
1K+ Views
If a Java class is a generic type and we are using it with the Gson library for JSON serialization and deserialization. The Gson library provides a class called com.google.gson.reflect.TypeToken to store generic types by creating a Gson TypeToken class and pass the class type. Using this type, Gson can able to ... Read More
raja
2K+ Views
A Jackson API is a java based library and it can be useful to convert Java objects to JSON and JSON to Java Object. A Jackson API is faster than other API, needs less memory area and is good for the large objects. We can process a JSON in three ... Read More
raja
2K+ Views
The JSON 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.JSON to MapSyntaxpublic T readValue(String content, ... Read More
raja
5K+ Views
The JSON can be used as a data-interchange format and is lightweight and language independent. A JSONArray can parse text from a String to produce a vector-like object and supports java.util.List interface. We can convert a JSON Array to CSV format using org.json.CDL class, it can provide a static method toString(), to convert a JSONArray into comma-delimited ... Read More
raja
3K+ Views
A Gson is a JSON library for java, which is created by Google. By using Gson, we can generate JSON and convert JSON to java objects. By default, Gson can print the JSON in compact format. To enable Gson pretty print, we must configure the Gson instance using the setPrettyPrinting() method of ... Read More