diff --git a/rpcserver.go b/rpcserver.go index 16e0677d..f4e13cd6 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -750,6 +750,17 @@ func (r *rpcServer) Start() error { } } + // The default JSON marshaler of the REST proxy only sets OrigName to + // true, which instructs it to use the same field names as specified in + // the proto file and not switch to camel case. What we also want is + // that the marshaler prints all values, even if they are falsey. + customMarshalerOption := proxy.WithMarshalerOption( + proxy.MIMEWildcard, &proxy.JSONPb{ + OrigName: true, + EmitDefaults: true, + }, + ) + // Finally, start the REST proxy for our gRPC server above. We'll ensure // we direct LND to connect to its loopback address rather than a // wildcard to prevent certificate issues when accessing the proxy @@ -757,7 +768,7 @@ func (r *rpcServer) Start() error { // // TODO(roasbeef): eventually also allow the sub-servers to themselves // have a REST proxy. - mux := proxy.NewServeMux() + mux := proxy.NewServeMux(customMarshalerOption) err := lnrpc.RegisterLightningHandlerFromEndpoint( context.Background(), mux, r.restProxyDest,