From 590a0c50f169221b8c27a664406ace3360726a69 Mon Sep 17 00:00:00 2001 From: George Steel Date: Fri, 26 Jan 2024 10:12:33 +0000 Subject: [PATCH] Additional guidance on json_encode for v3 migration Signed-off-by: George Steel --- docs/book/v3/migration/v2-to-v3.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/book/v3/migration/v2-to-v3.md b/docs/book/v3/migration/v2-to-v3.md index 2ac042c5..94fd41f6 100644 --- a/docs/book/v3/migration/v2-to-v3.md +++ b/docs/book/v3/migration/v2-to-v3.md @@ -98,3 +98,6 @@ function gravatarImage( The deprecated Json view helper has been removed. To encode data to Json for output in a view, you can call [`json_encode`](https://www.php.net/json_encode) directly. + +If you were relying on behaviour that was previously available via `laminas-json`, for example, calling object methods `toArray` or `toJson` prior to encoding, you should make the relevant objects implement `JsonSerializable`. +You can find documentation on the `JsonSerializable` interface [on the PHP website](https://www.php.net/manual/en/class.jsonserializable.php).