Sravani S

Sravani S

51 Articles Published

Articles by Sravani S

Page 6 of 6

How to convert Java Array/Collection to JSON array?

Sravani S
Sravani S
Updated on 30-Jul-2019 8K+ Views

Google provides a library named org.json.JSONArray and, following is the maven dependency to add library to your project. com.googlecode.json-simple json-simple 1.1 The JSONArray class of the org.json package provides put() method. Using this method, you can populate the JSONArray object with the contents of the elements.Exampleimport org.json.JSONArray; public class ArrayToJson { public static void main(String args[]) { String [] myArray = {"JavaFX", "HBase", "JOGL", "WebGL"}; JSONArray jsArray = new JSONArray(); ...

Read More
Showing 51–51 of 51 articles
« Prev 1 2 3 4 5 6 Next »
Advertisements