Raja has Published 760 Articles

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

raja

raja

Updated on 04-Jul-2020 05:50:07

3K+ Views

The JSON stands for JavaScript Object Notation and it can be used to transfer and storage of data. The JSONObject can parse text from a String to produce a map-like object. We can also construct a JSON object from a subset of another JSON object using the JSONObject(JSONObject jo, java.lang.String[] names) ... Read More

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

raja

raja

Updated on 04-Jul-2020 05:49:41

2K+ Views

The JSON is one of the widely used data-interchange formats and is a lightweight and language independent. The json.simple is a lightweight JSON processing library that can be used to encode or decode a JSON text. In the below program, we can convert a JSON String to Java object using the json.simple library.Exampleimport org.json.simple.*; import org.json.simple.parser.*; public class ... Read More

Convert a JSON object to XML format in Java?

raja

raja

Updated on 04-Jul-2020 05:48:56

6K+ Views

A JSON is a lightweight data-interchange format and the format of JSON is like a key-value pair. We can convert a JSONObject into an XML format using org.json.XML class, this provides static methods to convert an XML text into a JSONObject and to convert a JSONObject into an XML text. The XML.toString() method convert ... Read More

How can we parse a nested JSON object in Java?

raja

raja

Updated on 04-Jul-2020 05:48:09

13K+ Views

The JSON is a lightweight, text-based and language-independent data exchange format. The JSON can represent two structured types like objects and arrays. A JSONArray can parse text from a String to produce a vector-like object. We can parse a nested JSON object using the getString(index) method of JSONArray. This is a convenience method for the ... Read More

How can we merge two JSON objects in Java?

raja

raja

Updated on 04-Jul-2020 05:40:36

15K+ Views

A JSON is a lightweight data-interchange format and the format of JSON is a key with value pair. The JSONObject can parse a text from a String to produce a map-like object and supports java.util.Map interface. We can use org.json.simple.JSONObject to merge two JSON objects in Java.We can merge two JSON ... Read More

How can we add a JSONArray to JSONObject in Java?

raja

raja

Updated on 04-Jul-2020 05:36:04

16K+ Views

The JSON is a text-based format for exchanging data. It is a lightweight component and language independent. We can also add a JSONArray to JSONObject. We need to add a few items to an ArrayList first and pass this list to the put() method of JSONArray class and finally add this array to JSONObject using the put() method. Exampleimport org.json.*; ... Read More

How can we write JSON objects to a file in Java?

raja

raja

Updated on 04-Jul-2020 05:35:31

2K+ Views

The JSON is one of the widely used data-interchange formats and is a lightweight and language independent. The json.simple is a lightweight JSON processing library that can be used to write JSON files and it can be used to encode or decode JSON text and fully compliant with JSON specification(RFC4627). In order to read a JSON file, ... Read More

How can we convert a JSON string to a JSON object in Java?

raja

raja

Updated on 03-Jul-2020 14:06:49

5K+ Views

The JSON stands for JavaScript Object Notation and it can be used to transfer and storage of data.  The JSONObject can parse text from a String to produce a map-like object. The object provides methods for manipulating its contents, and for producing a JSON compliant object serialization. The JSONArray can parse text from a String ... Read More

How to display a JFrame to the center of a screen in Java?

raja

raja

Updated on 03-Jul-2020 13:39:50

17K+ Views

A JFrame is a subclass of Frame class and the components added to a frame are referred to as its contents, these are managed by the contentPane. We can add the components to a JFrame to use its contentPane instead. A JFrame is like a Window with border, title, and buttons. We can implement most ... Read More

How to display a JRadioButtonMenuItem in Java?

raja

raja

Updated on 03-Jul-2020 12:47:44

682 Views

A JRadioButtonMenuItem is a subclass of the JMenuItem class in Java. A JRadioButtonMenuItem is a menu item that is part of a group of menu items in which only one item in the group can be selected and the selected item displays its selected state. We can add multiple radio button menu ... Read More

Advertisements