Skip to content

Commit c60bb5d

Browse files
committed
json diff types of reading values
1 parent 4faa824 commit c60bb5d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

json-custom-parsing/src/main/java/com/cherkashyn/investigation/JsonMappingNested.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ public class JsonMappingNested {
2121

2222
public static JsonMappingNested fromMap(HashMap<String, ?> source){
2323
// mapping map to object
24+
// // With TypeReference
25+
// List<MyClass> myObjects = mapper.readValue(jsonInput, new TypeReference<List<MyClass>>(){});
26+
//
27+
// // with TypeFactory
28+
// List<MyClass> myObjects = mapper.readValue(jsonInput, mapper.getTypeFactory().constructCollectionType(List.class, MyClass.class));
2429
return new ObjectMapper().convertValue(source, FrameMetadata.class);
2530
}
2631

0 commit comments

Comments
 (0)