Original post

I am using Protobuf and gRPC. When making an API call and passing in an empty array, protobuf converts empty arrays to null, so I’m not able to check whether what’s being passed in is an empty array or null.

To get around that, I have to mess with my structs. I was wondering, what are the pros/cons of defining a structure as the one below rather than having an array.

users: {
    "123456": {
        name: "John Doe",
        age: 0,
        profession: "SWE"
    },
    
}

users : [
    {
        id: "123456",
        name: "John Doe",
        age: 0,
        profession: "SWE
    }
]