public static function type_json_encode($var, array $settings)
	{
		$var = json_encode($var);

		if (array_key_exists('character_maximum_length', $settings))
		{
			$length  = intval($settings['character_maximum_length']);
			if ($length > 0 and strlen($var) > $length)
			{
				throw new InvalidContentType('Value could not be JSON encoded, exceeds max string length for field.');
			}
		}

		return $var;
	}
public static function type_json_encode($var, array $settings)
	{
		$var = json_encode($var);

		if (array_key_exists('character_maximum_length', $settings))
		{
			$length  = intval($settings['character_maximum_length']);
			if ($length > 0 and strlen($var) > $length)
			{
				throw new InvalidContentType('Value could not be JSON encoded, exceeds max string length for field.');
			}
		}

		return $var;
	}
public static function type_json_encode ( $ var , array $ settings ) { $ var = json_encode ( $ var ) ; if ( array_key_exists ( 'character_maximum_length' , $ settings ) ) { $ length = intval ( $ settings [ 'character_maximum_length' ] ) ; if ( $ length > 0 and strlen ( $ var ) > $ length ) { throw new InvalidContentType ( 'Value could not be JSON encoded, exceeds max string length for field.' ) ; } } return $ var ; }
JSON encodes the input

@param   mixed  value
@param   array  any options to be passed

@throws  InvalidContentType

@return  string
JSON encodes the input