bug 1073923 - add url.toJSON() method

nit:  add a comment here to specify why we need a `toJSON` method in the first place