# tf.keras.utils.legacy.serialize_keras_object

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/keras-team/keras/tree/v2.13.1/keras/saving/legacy/serialization.py#L280-L338) |

Serialize a Keras object into a JSON-compatible representation.

#### View aliases


**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

\`tf.compat.v1.keras.utils.legacy.serialize_keras_object\`

<br />

    tf.keras.utils.legacy.serialize_keras_object(
        instance
    )

Calls to `serialize_keras_object` while underneath the
`SharedObjectSavingScope` context manager will cause any objects re-used
across multiple layers to be saved with a special shared object ID. This
allows the network to be re-created properly during deserialization.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `instance` | The object to serialize. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A dict-like, JSON-compatible representation of the object's config. ||

<br />