Package railo.runtime.functions.conversion

Source Code of railo.runtime.functions.conversion.IsJSON

package railo.runtime.functions.conversion;

import railo.commons.lang.StringUtil;
import railo.runtime.PageContext;
import railo.runtime.exp.PageException;
import railo.runtime.interpreter.JSONExpressionInterpreter;
import railo.runtime.op.Caster;

public class IsJSON {
  public static boolean call(PageContext pc, Object obj) {
    String str=Caster.toString(obj,null);
    if(StringUtil.isEmpty(str,true)) return false;
    try {
      new JSONExpressionInterpreter().interpret(pc, str);
      return true;
    } catch (PageException e) {
      return false;
    }
  }
 
}
TOP

Related Classes of railo.runtime.functions.conversion.IsJSON

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.