001    package railo.runtime.functions.conversion;
002    
003    import railo.runtime.PageContext;
004    import railo.runtime.converter.ConverterException;
005    import railo.runtime.converter.JSONConverter;
006    import railo.runtime.exp.PageException;
007    import railo.runtime.ext.function.Function;
008    import railo.runtime.op.Caster;
009    
010    /**
011     * Decodes Binary Data that are encoded as String
012     */
013    public final class SerializeJSON implements Function {
014    
015            public static String call(PageContext pc, Object var) throws PageException {
016                return call(pc,var,false);
017            }
018            public static String call(PageContext pc, Object var,boolean serializeQueryByColumns) throws PageException {
019                    try {
020                return new JSONConverter(true).serialize(pc,var,serializeQueryByColumns);
021            } catch (ConverterException e) {
022                throw Caster.toPageException(e);
023            }
024                    //throw new FunctionNotSupported("SerializeJSON");
025            }
026    }