Serialize request body¶
This operation converts a request body object into an indented JSON string using a Newtonsoft-based serializer configured with the client's DateTimeZoneHandling and member-handling settings.
| Field | Value |
|---|---|
| Operation ID | OP-04 |
| Trigger | RestSharp calls ISerializer.Serialize(object) when JsonHttpClient.GetJsonResponse invokes request.AddJsonBody(body). |
| Inputs | Request body object. |
| Outputs | Indented JSON string, with " as the quote character. |
| Primary components | JsonSerializer.Serialize, JsonSerializer constructor |
| Entry point | src/SAIF.Web.API.Clients/JsonSerializer.cs |
Steps¶
- Open a
StringWriter/JsonTextWriterpair for the output. - Set
Formatting.IndentedandQuoteChar = '"'on the writer. - Call
_serializer.Serialize(...), applyingMissingMemberHandling.Ignore,NullValueHandling.Include,DefaultValueHandling.Include, and the configuredDateTimeZoneHandling(BR-07, BR-21). - Return the resulting JSON string to RestSharp for inclusion in the request body.
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start(["AddJsonBody invoked by<br>RestSharp"]) --> S1["Open StringWriter and<br>JsonTextWriter"]
S1 --> S2["Configure<br>Formatting.Indented and<br>QuoteChar"]
S2 --> S3["Serialize object with<br>configured settings"]
S3 --> EndOk([Return JSON string])
Failure and edge-case behavior¶
- No error handling is performed within this operation; serialization exceptions from Newtonsoft propagate to the caller unmodified.*
Note: Statements marked with
*were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.
Related documentation¶
Sources¶
- src/SAIF.Web.API.Clients/JsonSerializer.cs