Mecha CMS

$u_r_l->jsonSerialize()

Convert Anemon class instance to JSON.

2.2.0 \JsonSerializable

$u_r_l->jsonSerialize(void);

Example:

$url = new URL('https://mecha-cms.com/foo/bar/1?baz=qux#asdf', '/foo');

echo To::JSON($url, true);

Result:

{
    "clean": "http:\/\/127.0.0.1\/foo\/bar",
    "current": "http:\/\/127.0.0.1\/foo\/bar\/1?baz=qux#asdf",
    "d": "\/foo",
    "ground": "http:\/\/127.0.0.1",
    "hash": "#asdf",
    "host": "127.0.0.1",
    "i": "\/1",
    "path": "\/bar",
    "port": null,
    "protocol": "http:\/\/",
    "query": "?baz=qux",
    "root": "http:\/\/127.0.0.1\/foo"
}