$pages->toJson()

Converts the collection to a JSON string