Was trying to convert a Sequence object to JSON, and just getting {} as the result. However, serializing $sequence->all() works just fine - gives me an array of items. Obviously the items themselves need to be serializable too, but that's not php-collection's problem.
So, could Sequence (and I guess the other collection types) be given JSON serialisation support? It is probably just as simple as adding this method and implementing \JsonSerializable:
public function jsonSerialize() {
return $this->all();
}
I can provide a PR if this is something you would like.
Was trying to convert a
Sequenceobject to JSON, and just getting{}as the result. However, serializing$sequence->all()works just fine - gives me an array of items. Obviously the items themselves need to be serializable too, but that's not php-collection's problem.So, could
Sequence(and I guess the other collection types) be given JSON serialisation support? It is probably just as simple as adding this method and implementing\JsonSerializable:I can provide a PR if this is something you would like.