java Array Form Creation Question

Asked 1 years ago, Updated 1 years ago, 131 views

Data type ArrayList Map String,Object

Result value

[0] "date" = 2019-08-0100:00:00", "work" : "work", "department" : "username" : "potato" > [1] "date" = 2019-08-0100:00:00", "work" : "work" , "department" : "username" : "sweet potato [2] "date" = 2019-08-0100:00:00", "work" : "work", "department" : "department", "username" : "moo"> [3] "date" = 2019-08-0200:00", "work" : "work", "department" : "department", "username" : "potato" >

I'd like to process it so that it comes out in the following format, so what should I do? ㅠ<

{ username: "Potato", department: "Department", schedule : [{date : 2019-08-0100:00:00, work : work }, {date : 2019-08-0200:00, work : work }] }

java array map response

2022-09-21 17:30

1 Answers

The object stored in the collection can be reassembled in the form desired by the questioner and extracted as object to json.

I recommend Jackson for the library.

https://www.mkyong.com/java/jackson-2-convert-java-object-to-from-json/


2022-09-21 17:30

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.