All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.redismq.utils.JsonSerializerUtil Maven / Gradle / Ivy

There is a newer version: 1.2.1
Show newest version
package com.redismq.utils;

import org.apache.commons.lang3.StringUtils;

public class JsonSerializerUtil {
    public static boolean isJson(String bodyStr) {
        if (StringUtils.isBlank(bodyStr)) {
            return false;
        }
        return isWrap(bodyStr.trim(), '{', '}') || isWrap(bodyStr.trim(), '[', ']');
    }
    
    public static boolean isWrap(CharSequence str, char prefixChar, char suffixChar) {
        if (null == str) {
            return false;
        }
        
        return str.charAt(0) == prefixChar && str.charAt(str.length() - 1) == suffixChar;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy