}
public void toJSON(Object obj, Output out)
{
String clsName=obj.getClass().getName();
Convertor convertor=_json.getConvertorFor(clsName);
if (convertor==null)
{
try
{
Class cls=Loader.loadClass(JSON.class,clsName);
convertor=new JSONPojoConvertor(cls,_fromJSON);
_json.addConvertorFor(clsName, convertor);
}
catch (ClassNotFoundException e)
{
e.printStackTrace();
}
}
if (convertor!=null&&obj.getClass()!=Object.class)
{
convertor.toJSON(obj, out);
}
else
{
out.add(obj.toString());
}