CodeGym /Java Course /Java Collections /Tasks | Level 3 | Lesson 5

Tasks | Level 3 | Lesson 5

Java Collections
Level 3 , Lesson 5
Available
14
Task
Java Collections, level 3, lesson 5
Locked
My first serialization into JSON
REQUIRED CONNECTED LIBRARIES: Jackson Core, Bind and Annotation 2.6.1 1) The program does not fulfill the main requirement for serialization into JSON. Find the bug and fix it. 2) Correctly arrange the JSON annotations on the classes. All the data must be serialized.
8
Task
Java Collections, level 3, lesson 5
Locked
My second serialization into JSON
REQUIRED CONNECTED LIBRARIES: Jackson Core, Bind and Annotation 2.6.1 Add JSON annotations so that the main method produces the following: {"wildAnimal":"Missy","over":3}
14
Task
Java Collections, level 3, lesson 5
Locked
Deserializing a JSON object
REQUIRED CONNECTED LIBRARIES: Jackson Core, Bind and Annotation 2.6.1 In the convertFromJsonToNormal method, the first parameter is the name of a file that contains one JSON object. The second parameter is the name of the class of the object serialized in the file.
14
Task
Java Collections, level 3, lesson 5
Locked
Using JSON to convert from one class to another
REQUIRED CONNECTED LIBRARIES: Jackson Core, Bind and Annotation 2.6.1 Two classes have the same fields, but they don't have a common superclass. Example, First and Second classes. Implement the convertOneToAnother method, which should return an instance of the resultClassObject class.
14
Task
Java Collections, level 3, lesson 5
Locked
Using JSON to convert from one class to another
REQUIRED CONNECTED LIBRARIES: Jackson Core, Bind and Annotation 2.8.1 Add JSON annotations so that the main method.
14
Task
Java Collections, level 3, lesson 5
Locked
Strange mistake
REQUIRED CONNECTED LIBRARIES: Jackson Core, Bind and Annotation 2.6.1 Running the code in the Solution class's main method results in a strange error during JSON serialization/deserialization. The sampleJsonString string should be displayed, but that's not exactly what happens.
14
Task
Java Collections, level 3, lesson 5
Locked
Serializing a zoo
Make it so that a type is added to each element of the animals list when you serialize a Zoo object (dog for the Dog class, cat for the Cat class). To check, you can use the Solution class's main method. Before: {"animals":[{"name":"doggy","barkVolume":0.0},{"name":"catty","lives":0}]}.
8
Task
Java Collections, level 3, lesson 5
Locked
Serializing a date into JSON
Using the JsonFormat annotation, make it so the Event class's field containing a date is serialized in the format (dd-MM-yyyy hh:mm:ss).
Comments (7)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
MaGaby2280 Level 41, Guatemala City, Guatemala
3 June 2021
This is a very interesting link for learning more about Jackson. My suggestion is to read it before doing the tasks... https://www.baeldung.com/jackson It also contains great examples This link contains all the files you need to download to use Jackson in these tasks https://mvnrepository.com/artifact/com.fasterxml.jackson.core
Lisa Level 41
1 January 2022
The CG explanations are a joke. But the baeldung and jenkov tutorials are OK and all one needs to understand the topic and solve the tasks. Btw., Jackson installation via maven is a breeze. (IntelliJ -> project structure -> libraries -> add lib (the +)) and chose maven. Search for com.fasterxml, chose to install sources, docs and annotations and select the latest versions of core and core.databind (you can select an older version for the CG tasks later on in IntelliJ settings). To change the version select the library (eg. fasterxml.jackson.core) click edit and select your desired version In modules dependencies the two libraries need to be listed (with scope compile), if not, just add them
Alexander Shtunder Level 41, San Francisco, USA
27 July 2020
I think it will be helpful. Link to download the required Jackson libraries: link
Elvis Lee Level 41, Aurora, United States
2 February 2020
Using Json to convert one class to other class, use objectMapper.disable(MapperFeature.USE_ANNOTATIONS) before writeValue and readValue
Juan Ma Level 41, Arauca, Colombia
30 May 2020
You can use the replaceFirst(regex, string) string method as well.
Senned Level 41, Azov, Russia
5 December 2019
Read more about Jackson annotations before start!
Almaz Temirkanov Level 24, Bishkek, Kyrgyzstan
14 November 2019
#2 @JsonProperty("over")