Created
November 20, 2013 00:25
-
-
Save sdpatil/7555184 to your computer and use it in GitHub Desktop.
JsonSerializer Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.spnotes.misc.com.spnotes.misc; | |
import com.spnotes.misc.Contact; | |
import org.codehaus.jackson.map.ObjectMapper; | |
import java.util.Calendar; | |
import java.util.Date; | |
/** | |
* Created by gpzpati on 11/19/13. | |
*/ | |
public class JSONTester { | |
public static void main(String[] argv) throws Exception{ | |
Contact contact = new Contact(); | |
contact.setFirstName("Sachin"); | |
contact.setLastName("Tendulkar"); | |
ObjectMapper objectMapper = new ObjectMapper(); | |
Calendar cal = Calendar.getInstance(); | |
cal.set(1973,3,24); | |
contact.setDateOfBirth(cal.getTime()); | |
System.out.println(objectMapper.writeValueAsString(contact)); | |
//objectMapper.writeValue(, contact); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment