postman-app-support icon indicating copy to clipboard operation
postman-app-support copied to clipboard

Sending struct via GRPC request

Open v1lev opened this issue 3 years ago • 18 comments

Is there an existing issue for this?

  • [X] I have searched the tracker for existing similar issues

Describe the Issue

Hi! I can't figure out how to properly send google.protobuf.Struct. Whenever I add a Struct field to the message it is received just as an empty field on the server.

Server = Python application with gRPC AsyncIO API Client = Postman

Sample message definition:

syntax = "proto3";
import "google/protobuf/struct.proto";


message Message {
  google.protobuf.Struct data = 1;
  google.protobuf.Struct another_data = 2;
}

Sample message that is sent via UI:

{
  "data": {
    "key": "value"
  }
  "another_data": {}
}

No matter of keys and values the data field is always empty at the server side.

Steps To Reproduce

  1. Create GRPC api with a request containing google.protobuf.Struct field
  2. Import it into Postman, create a request
  3. Fill a Struct field with a JSON-like entity
  4. At the server side the Struct field will be empty

Screenshots or Videos

No response

Environment Information

- Operating System: macOS Monterey 12.1
- Platform Type: Native App
- Postman Version: v9.14.13

Additional Context?

No response

v1lev avatar Mar 14 '22 14:03 v1lev

I would like to add that the struct is also received wrong.

My proto message:

message MyMessage {
  google.protobuf.Struct data = 1;
}

I take this JSON:

{ 
  "myKey1": "myValue1",
  "myKey2": "myValue2"
}

And convert it in a C++ app with ::google::protobuf::util::JsonStringToMessage.

Having this done I expected to see in Postmane just the same JSON structure as I sent from the service. But what I get in postman is a "json of json":

{
    "key": "json",
    "value": {
        "struct_value": {
            "fields": [
                {
                    "key": "myKey1",
                    "value": {
                        "string_value": "myValue1"
                    }
                },
                {
                    "key": "myKey2",
                    "value": {
                        "string_value": "myValue2"
                    }
                }
            ]
        }
    }
}

igor-sirotin avatar Jul 19 '22 10:07 igor-sirotin

Similar bug happened to me too, the request worked with GrpcUI, but the server got an empty map when I copy pasted the same raw JSON to postman

Chen-hao-Huang avatar Jan 24 '23 19:01 Chen-hao-Huang

@aawwsed10 Can you share the type definition and JSON value (without any sensitive information)?

codenirvana avatar Jan 24 '23 20:01 codenirvana

@aawwsed10 Can you share the type definition and JSON value (without any sensitive information)?

{
    "object": {
        ...     
        "attributes": {"test":"123"},
        ...
    }
}

message Object{
...
    google.protobuf.Struct attributes = 12;                
...
}

and using postman the server would get map[] and with grpcui the server gets map[test:123]

Chen-hao-Huang avatar Jan 24 '23 20:01 Chen-hao-Huang

Same issue Request:

{
    "data": {
        "action": "deposit"
    },
    "id": 8
}

Proto:

message UpdateTemplateRequest {
  int32 id = 1;
  google.protobuf.Struct data = 2;
}

Actual request data on server: id:8 data:{}

const-tmp avatar Jan 31 '23 16:01 const-tmp

Why you guys still didn't fixed it? It's a major bug

rahulrayal avatar Mar 15 '23 08:03 rahulrayal

It happen to me too, I was using postman with gRPC to send a struct-type property into golang applications. The apps didn't receive the payload completely, especially for the struct-type. Is there any progress on this issue?

glovenkevin avatar Mar 28 '23 02:03 glovenkevin

google.protobuf.Struct - do not work :(

More and more people are facing this problem. We like this product but we are forced to look for other alternatives - it's a pity.

Can you please tell us when you can start solving this problem?

lanzay avatar Apr 28 '23 10:04 lanzay

I don't know if any of you come to this post, but currently, I managed to use the gRPC struct value with some syntax provided. Probably this issue has been solved.

here is a simple sample of how I managed to send the struct value

...
"recipient": [
        "9a71327e-5ac6-46a8-8219-2e2cadeed303"
    ],
    "payload": {"fields": {
        "action_url": {
            "string_value": "https://xxxx.xxxx"
        },
        "request_number": {
            "string_value": "asdf"
        }
    }},
    "sender": "f7e442bc-14f7-4ee0-99c9-b317a190af45",
...

the struct value is set up to the object, and there is already a syntax for it. like image

it is the same as the igor-sirotin mention before,

glovenkevin avatar May 11 '23 05:05 glovenkevin

I faced that issue too. I've spent a lot of time debugging my code but it looks like there is an issue with Postman.

o-shevchenko avatar Aug 10 '23 13:08 o-shevchenko

The issue is still existing at of 2023 Dec 27 with

Version 10.21.9
UI Version: 10.21.9-ui-231220-0601
Desktop Platform Version: 10.21.0 (10.21.0)

Spent hours to figure out what went wrong :(

xuanyuwang avatar Dec 28 '23 00:12 xuanyuwang

I am facing this also, now

panoet avatar Feb 05 '24 08:02 panoet

We are also seeing the same problem. When we use the server reflection proto definition, everything works great. However, when we make a GRPC call while importing the proto file, it truncates the data in the fields it is sending to server. Also,server reflection expects 'google.protobuf.Struct' in the request in a different format, while importing the proto file expects the 'google.protobuf.Struct' in the request in a different format .

For eg: If I have message like this in the proto file:

syntax = "proto3";
import "google/protobuf/struct.proto";


message Message {
  google.protobuf.Struct data = 1;
  string user_id = 2;
}

For Server reflection postman is expecting this in request:

{
    "data": {
        "fields": [
            {
                "key": "email",
                "value": {
                    "string_value": "[email protected]"
                }
            },
            {
                "key": "address",
                "value": {
                    "string_value": "Delhi, India"
                }
            }
         ]
     },
     user_id: "test-id"
 }      
            

When I import the proto file on postman:

{
    "data": {
        "fields": {
            "email": {
               "string_value": "[email protected]"
               },
            "address": {
                 "stringValue":"Delhi, India"
                 }
            }
      },
    user_id: "test-id"
}

The server reflection request works fine but the one I am sending while importing proto file doesn't.

anmol242 avatar Feb 15 '24 14:02 anmol242

Still experiencing this on July 15, 2024

PJEstrada avatar Jul 15 '24 20:07 PJEstrada

Same problem here...

iurydias avatar Aug 08 '24 21:08 iurydias

I am still facing this issue!

Sahil-Agarwal-DD avatar Sep 10 '24 10:09 Sahil-Agarwal-DD

Below is what worked for me. Using server reflection. Postman Version 11.11.1

{
    "my_struct_field": {
        "fields": {
            "my_field_name": {
                "string_value": "abc"
            }
        }
    }
}

xsor-hbo avatar Sep 10 '24 13:09 xsor-hbo

When I use server reflection, I get this - (properties is the struct field) Postman Version 11.11.1

"properties": {
                    "fields": [
                        {
                            "key": "anim consequat culpa nisi aliquip",
                            "value": {}
                        },
                        {
                            "key": "nulla irure dolor laboris dolor",
                            "value": {}
                        },
                        {
                            "key": "do aliqua anim laboris cupidatat",
                            "value": {}
                        }
                    ]
                },

On using the format that @xsor-hbo provided, it worked fine for me. Thank you.

Sahil-Agarwal-DD avatar Sep 10 '24 15:09 Sahil-Agarwal-DD

11.33.5 in 2025, it's still there, what a shame!

andrey-tikhov avatar Feb 24 '25 08:02 andrey-tikhov

I encountered this issue now and been trying to fix since this morning. It's weird that AI models recommend using Struct for objects that won't work.

reinarudo avatar Jun 10 '25 09:06 reinarudo

I am experiencing this same thing. My inbound request message includes Struct contents, but when reading the contents using debugger in my Java application it is empty.

Breefield avatar Aug 22 '25 17:08 Breefield

Thanks for reporting this!

This issue has been fixed in Postman v11.67.0. 🎉 Postman now correctly follows the canonical JSON representations for Google's well-known types — Struct, Duration, and Timestamp — in both request payloads and responses.

This update brings Postman in line with the official protoJSON specification.

Please update to the latest version to get the fix, and feel free to reopen this issue if you continue to experience any problems.

Image

ankurdengla avatar Oct 13 '25 14:10 ankurdengla