/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mafia.server.util;

import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Just1689
 */
public class JacksonUtil<T> {

    public T stringToObject(String json, Class clazz) {
        ObjectMapper objectMapper = new ObjectMapper();
        try {
            T result = (T) objectMapper.readValue(json, clazz);
            return result;
        } catch (IOException ex) {
            Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, null, ex);
        }
        return null;
    }

}

@@ -210,16 +210,75 @@
 .util;%0A%0A
+import com.fasterxml.jackson.core.JsonProcessingException;%0A
 import c
@@ -852,10 +852,351 @@
 %0A    %7D%0A%0A
+    public String objectToString(T t) %7B%0A        try %7B%0A            ObjectMapper objectMapper = new ObjectMapper();%0A            return objectMapper.writeValueAsString(t);%0A        %7D catch (JsonProcessingException ex) %7B%0A            Logger.getLogger(JacksonUtil.class.getName()).log(Level.SEVERE, null, ex);%0A        %7D%0A        return null;%0A    %7D%0A%0A
 %7D%0A

Object to json