N
N
Nikolay Baranenko2017-06-08 16:43:16
Java
Nikolay Baranenko, 2017-06-08 16:43:16

Does this json have a chance to be deserialized?

Hello.
Is it possible to deserialize this json from string

{"Employee":"сотрудник1","map_list":{"Input_Weight_11":"0.2","Input_Weight_12":"0.3","Input_Weight_13":"0.2"}},
{"Employee":"сотрудник2","map_list":{"Input_Weight_21":"0","Input_Weight_22":"0","Input_Weight_23":"0"}},
{"Employee":"сотрудник3","map_list":{"Input_Weight_31":"0","Input_Weight_32":"0","Input_Weight_33":"0"}}

tried to transfer from string to JSONObject
JSONObject jsonObject = new JSONObject(jsonData);
System.out.println(jsonObject.names().length());
System.out.println(jsonObject.names().size());

result 2
Is serialization possible in this case? and in what way?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
n-fom, 2017-06-08
@drno-reg

In this case, you need to wrap in "[", "]" - this is JsonArray
docs.oracle.com/javaee/7/api/javax/json/JsonArray.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question