RPC v2 JSON
smithy.protocols#rpcv2Json is the JSON variant of Smithy’s RPC v2 protocol.
It shares routing, headers, errors, and event streams with
RPC v2 CBOR and carries JSON bodies instead of CBOR.
NSmithy generates typed clients and ASP.NET Core servers for unary and event
stream operations.
See Protocol Status for maturity and current conformance numbers.
Protocol behavior
Section titled “Protocol behavior”| Area | rpcv2Json |
|---|---|
| Route | POST /service/{Service}/operation/{Operation} |
| Body | JSON |
| Content type | application/json |
| Operation header | Smithy-Protocol: rpc-v2-json |
| Errors | Modeled type in the JSON __type member |
| Streaming | Input, output, and duplex event streams |
| HTTP bindings | Not used |
JSON serialization differs from restJson1 in three places:
| Shape or trait | rpcv2Json |
|---|---|
@jsonName | Ignored. Properties use member names. |
timestamp | Always epoch seconds. @timestampFormat is ignored. |
bigInteger, bigDecimal | JSON strings, such as "9223372036854775808" |
Modeling
Section titled “Modeling”Apply @rpcv2Json to the service. Operations do not use @http:
$version: "2"
namespace example.weather
use smithy.protocols#rpcv2Json
@rpcv2Jsonservice Weather { version: "2026-01-01" operations: [GetCity]}A service can declare both @rpcv2Cbor and @rpcv2Json. Both protocols use
the same routes, so a server maps each on its own endpoint route builder.
On the wire
Section titled “On the wire”POST /service/Weather/operation/GetCity HTTP/1.1Host: api.example.comSmithy-Protocol: rpc-v2-jsonContent-Type: application/jsonAccept: application/json
{"cityId":"123"}
HTTP/1.1 400 Bad RequestSmithy-Protocol: rpc-v2-jsonContent-Type: application/json
{"__type":"example.weather#NoSuchResource","resourceType":"city"}Streaming
Section titled “Streaming”Event streams use the same framing as rpcv2Cbor. Event payloads and the initial-request and initial-response messages are JSON.
Packages
Section titled “Packages”| Surface | Packages |
|---|---|
| Client | NSmithy.Client, NSmithy.Codecs.Json, NSmithy.Protocols.RpcV2Json |
| Server | NSmithy.Server.AspNetCore, NSmithy.Codecs.Json, NSmithy.Protocols.RpcV2Json |