Skip to content

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.

Arearpcv2Json
RoutePOST /service/{Service}/operation/{Operation}
BodyJSON
Content typeapplication/json
Operation headerSmithy-Protocol: rpc-v2-json
ErrorsModeled type in the JSON __type member
StreamingInput, output, and duplex event streams
HTTP bindingsNot used

JSON serialization differs from restJson1 in three places:

Shape or traitrpcv2Json
@jsonNameIgnored. Properties use member names.
timestampAlways epoch seconds. @timestampFormat is ignored.
bigInteger, bigDecimalJSON strings, such as "9223372036854775808"

Apply @rpcv2Json to the service. Operations do not use @http:

model/weather.smithy
$version: "2"
namespace example.weather
use smithy.protocols#rpcv2Json
@rpcv2Json
service 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.

POST /service/Weather/operation/GetCity HTTP/1.1
Host: api.example.com
Smithy-Protocol: rpc-v2-json
Content-Type: application/json
Accept: application/json
{"cityId":"123"}
HTTP/1.1 400 Bad Request
Smithy-Protocol: rpc-v2-json
Content-Type: application/json
{"__type":"example.weather#NoSuchResource","resourceType":"city"}

Event streams use the same framing as rpcv2Cbor. Event payloads and the initial-request and initial-response messages are JSON.

SurfacePackages
ClientNSmithy.Client, NSmithy.Codecs.Json, NSmithy.Protocols.RpcV2Json
ServerNSmithy.Server.AspNetCore, NSmithy.Codecs.Json, NSmithy.Protocols.RpcV2Json