Make toJSON a bit more recursive