Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
MyValue  myResultObject = new MyValue();
myResultObject.name = "MyName";
myResultObject.age= 11;

ObjectMapper mapper = new ObjectMapper();
 
// result.json 파일로 저장
mapper.writeValue(new File("result.json"), myResultObject);
// byte[] 로 저장
byte[] jsonBytes = mapper.writeValueAsBytes(myResultObject);
// string 으로 저장
String jsonString = mapper.writeValueAsString(myResultObject);

...