Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.askfast.util;
 
 
 public class JSONUtil
 {
 //    private static final Logger log = Logger.getLogger( JSONUtil.class.getName() );
 
    public static <T> T deserializeString jsonStringClass<T> DeserializeClass )
    throws Exception
    {
        T deserializedEntity = null;
        if ( jsonString != null && !jsonString.isEmpty() )
        {
            deserializedEntity = new ObjectMapper().readValuejsonStringDeserializeClass );
        }
        return deserializedEntity;
    }
    public static String serializeObject objectToBeSerialized ) throws Exception
    {
        ObjectMapper oMapper = new ObjectMapper();
        oMapper.setSerializationInclusion. );
        String result = null;
        if ( oMapper.canSerializeobjectToBeSerialized.getClass() ) )
        {
            result = oMapper.writeValueAsStringobjectToBeSerialized );
        }
        return result;
    }
New to GrepCode? Check out our FAQ X