Comments (4)
@Harold2017, looks to me like you are using the tool correctly.
That error message means that, while trying to unmarshal the JSON data into a request, it encountered the start of an object -- the curly brance {
-- where it was expecting a string value. It expects string values as keys in an object (i.e. field names) and also for fields whose type in the protobuf source is string
or bytes
.
I can't help you troubleshoot further without a small repro case that includes the protobuf source for the service and message and a JSON payload that triggers the error.
from grpcurl.
@jhump , many thanks!
If i want to accept this request json as string on server side like the following .proto presents:
// reception
message Command {
string appid = 1; // sender tag
string jsonData = 2; // json string
string others = 3;
}
do i need to change the reception type to struct jsonData = 2
?
I will try it later and update to you, thanks!
from grpcurl.
@Harold2017, yes, you'd need to import "google/protobuf/struct.proto"
and then define the field's type as google.protobuf.Struct
. That allows it to represent any JSON object.
As is, defined as a string
, you'd need to nest that field's JSON payload into a string. Like so:
{
"appid": "foo",
"jsonData": "{ \"nested\": \"json\" }",
"others": "bar"
}
from grpcurl.
@jhump You're right! Many thanks!
from grpcurl.
Related Issues (20)
- Whether I can get the structure of the request parameters and response parameters of the grpc interface, this is very useful to me HOT 5
- Bump google.golang.org/grpc for CVE issue HOT 1
- With an UnaryResponse, OnReceiveResponse is never called HOT 1
- Fails to display response headers in case of "unexpected HTTP status code"
- Security Vulnerability: Update grpc version to at least 1.58.3 HOT 8
- Fail to inspect custom `gRPC` server HOT 2
- BUG - Failed to list methods for service "tamama.grpc.Tamama": Symbol not found: tamama.grpc.Tamama HOT 4
- `remote reset` error with 1.8.8 and higher HOT 1
- Wrong error message if a server requires client certificates
- Unix Domain Socket connection should use `localhost` authority header convention by default HOT 2
- Add the OpenSSF Scorecard Github Action HOT 1
- Attempts to install fail because of "missing do in first path element" HOT 2
- Cannot list methods of a service and make requests HOT 1
- Publish releases to winget HOT 1
- Possible to support other codec? HOT 1
- Server reflection fails when using well-known types (Timestamp) HOT 3
- Google Cloud Run producing `context deadline exceeded`
- protoset-out does not get namespace when using reflection HOT 5
- Create Process Failed to Run Issue HOT 1
- Include more output while connecting and reflecting with verbose mode
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grpcurl.