master

laravel/framework

Last updated at: 29/12/2023 09:21

Jsonable.php

TLDR

The Jsonable.php file is part of the Illuminate\Contracts\Support namespace and contains the Jsonable interface. This interface defines a method toJson() which is used to convert an object to its JSON representation.

Methods

toJson

Converts the object to its JSON representation.

  • Parameters:
    • $options (optional, integer): The JSON encoding options. Defaults to 0.
  • Returns:
    • string: The JSON representation of the object.
<?php

namespace Illuminate\Contracts\Support;

interface Jsonable
{
    /**
     * Convert the object to its JSON representation.
     *
     * @param  int  $options
     * @return string
     */
    public function toJson($options = 0);
}