System.Text.Json.Nodes.JsonNode SerializedPairs { get; set; }

robot_2Generated
code_blocksInput

Description

The SerializedPairs property provides access to the serialized form of the Pairs property within the CollisionRules class. This property is used for JSON serialization and deserialization, allowing the collision rules to be stored and transmitted in a JSON format. The property is decorated with the JsonInclude and JsonPropertyName attributes to ensure it is included in JSON operations and is named "Pairs" in the JSON output.

Usage

Use the SerializedPairs property when you need to serialize or deserialize the collision rules to or from JSON. This is particularly useful for persisting collision rules or transmitting them over a network. The property is automatically handled by the JSON serializer, so you typically do not need to interact with it directly unless you are implementing custom serialization logic.

Example

// Example of accessing the SerializedPairs property
CollisionRules collisionRules = new CollisionRules();

// Serialize the collision rules to JSON
string json = JsonSerializer.Serialize(collisionRules);

// Deserialize the JSON back to a CollisionRules object
CollisionRules deserializedRules = JsonSerializer.Deserialize<CollisionRules>(json);

// Access the SerializedPairs property
JsonNode serializedPairs = deserializedRules.SerializedPairs;