001    package railo.runtime.functions.conversion;
002    
003    import railo.commons.lang.StringUtil;
004    import railo.runtime.PageContext;
005    import railo.runtime.exp.PageException;
006    import railo.runtime.interpreter.JSONExpressionInterpreter;
007    import railo.runtime.op.Caster;
008    
009    public class IsJSON {
010            public static boolean call(PageContext pc, Object obj) {
011                    String str=Caster.toString(obj,null);
012                    if(StringUtil.isEmpty(str,true)) return false;
013                    try {
014                            new JSONExpressionInterpreter().interpret(pc, str);
015                            return true;
016                    } catch (PageException e) {
017                            return false;
018                    }
019            }
020            
021    }