Answers for "list to json in java"

1

list to json python

import json
friends_list = [
    'John','Rambo','Sam',
]
json_format = json.dumps(friends_list)
print(json_format)
print(type(json_format))
#PYTHON OUTPUT
["John", "Rambo", "Sam"]
<class 'str'>
Posted by: Guest on July-14-2020
0

json array to List in java

List<Employee> list = mapper.readValue(jsonString,
TypeFactory.defaultInstance().constructCollectionType(List.class,  
   Employee.class));
Posted by: Guest on May-22-2021
0

convertir lista a Json en Java

List<String> foo = new ArrayList<String>();
foo.add("A");
foo.add("B");
foo.add("C");

String json = new Gson().toJson(foo );
Posted by: Guest on December-15-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language