public static function _toJSON ($params = array (), $attributes = FALSE, $addClass = FALSE, &$db = FALSE)
	{
		
		// Get objects
		
		$rows	= static::_toArray ($params, $attributes, $db);
		
		// Add the class name if required
		
		if ($addClass)
		{
					
			// Set class name for the elements
			// Remove the Sonic\Model prefix and convert namespace \ to _

			$class	= str_replace ('\\', '_', str_replace ('sonic\\model\\', '', strtolower (get_called_class ())));
			
			foreach ($rows as &$row)
			{
				$row['class']	= $class;
			}
			
		}
		
		// Return json encoded
		
		return json_encode ($rows);
		
	}