---
schema_version: "1"
id: a4fa50fc930b769407e27dc952be96596b9e9bc109a7a312267269bfb1604fa0
title: |-
  Serializing and Deserializing ConnectApi
      Objects
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexcode/apex_connectapi_serialization.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_connectapi_serialization.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: e51032391504ce24df31c08a13e02de6520e5e8056779c12e8130e735520474a
description: When ConnectApi output objects are serialized into JSON, the structure is similar to the JSON returned from Connect REST API. When ConnectApi input objects are deserialized from JSON, the format is also similar to Connect REST API.
---
# Serializing and Deserializing ConnectApi Objects

When ConnectApi output objects are serialized into JSON, the structure is similar to the JSON returned from Connect REST API. When ConnectApi input objects are deserialized from JSON, the format is also similar to Connect REST API.

Connect in Apex supports serialization and deserialization in these Apex contexts.

- JSON and JSONParser classes—serialize Connect in Apex outputs to JSON and deserialize Connect in Apex inputs from JSON.
- Apex REST with @RestResource—serialize Connect in Apex outputs to JSON as return values and deserialize Connect in Apex inputs from JSON as parameters.
- JavaScript Remoting with @RemoteAction—serialize Connect in Apex outputs to JSON as return values and deserialize Connect in Apex inputs from JSON as parameters.

Connect in Apex follows these rules for serialization and deserialization.

- Only output objects can be serialized.
- Only top-level input objects can be deserialized.
- Enum values and exceptions cannot be serialized or deserialized.