Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java list to jsonelement

// needed imports
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import java.util.*;


Gson gson = new Gson();
JsonObject jsonObject = new JsonObject();
List<String> myList = new ArrayList<>();

jsonObject.add("myList", gson.toJsonTree(myList));
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #java #list #jsonelement
ADD COMMENT
Topic
Name
9+1 =