code: public String resource_to_string(base_resource resrc, options option, String onerror) 
  	{
  		String result = "{ ";
  		
  		if (option != null || (!onerror.equals(""))) 
  		{ 
  			result = result + "\"params\":{";
  			if(option != null)
  			{
  				if (option.get_action() != null) {
  					result = result + "\"action\":\"" + option.get_action() + "\",";
  				}					
  			}
  			
  			if((!onerror.equals("")))
  			{			
  				result = result +"\"onerror\":\"" + onerror +"\"";			
  			}		
  			result  = result + "},";
  		}
  		
  		result = result + "\"" + resrc.get_object_type() + "\":" + this.resource_to_string(resrc) + "}";
  		return result;
  	}
docs: Converts MPS resource to Json string.
  @param resrc nitro resource.
  @param option options class object.
  @return returns a String