We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4f78388 commit 7e46ceaCopy full SHA for 7e46cea
lib/internal/Magento/Framework/Controller/Result/Json.php
@@ -59,7 +59,11 @@ public function __construct(
59
*/
60
public function setData($data, $cycleCheck = false, $options = [])
61
{
62
- $this->json = $this->serializer->serialize($data);
+ if (is_object($data) && method_exists($data, 'toJson')) {
63
+ $this->json = $data->toJson();
64
+ } else {
65
+ $this->json = $this->serializer->serialize($data);
66
+ }
67
return $this;
68
}
69
0 commit comments