toJSONObject

open fun toJSONObject(string: String): JSONObject

Convert a cookie specification string into a JSONObject. The string must contain a name value pair separated by '='. The name and the value will be unescaped, possibly converting '+' and '%' sequences. The cookie properties may follow, separated by ';', also represented as name=value (except the Attribute properties like "Secure" or "HttpOnly", which do not have a value. The value TRUE will be used for these). The name will be stored under the key "name", and the value will be stored under the key "value". This method does not do checking or validation of the parameters. It only converts the cookie string into a JSONObject. All attribute names are converted to lower case keys in the JSONObject (HttpOnly => httponly). If an attribute is specified more than once, only the value found closer to the end of the cookie-string is kept.

Return

A JSONObject containing "name", "value", and possibly other members.

Parameters

string

The cookie specification string.

Throws

If there is an error parsing the Cookie String. Cookie strings must have at least one '=' character and the 'name' portion of the cookie must not be blank.