Skip to content

Decode to a temporary message to extract or change data #260

@amyrprv

Description

@amyrprv

Hi,
I have the below data for example

{
  "a": {
    "b": "",
    "c": {},
    "d": [
      {
        "e": "",
        "f": "s",
        "g": {
          "h": "",
          "i": "",
          "j": ""
        }
      }
    ],
    "k": {}
  },
  "l": {
    "m": { "t": "u" },
    "n": "v",
    "o": {
      "p": "̊w",
      "q": { "x": 1, "y": 1, "z": 1, "a1": 0 },
      "e": a2
    }
  }
}

Now, I aim to modify the e field within this structure. While I lack the Protobuf definition and message name, I possess the field number path to access e. I plan to generate a temporary message using the provided field numbers, decode the binary, modify the value, and then encode it again.

However, I've encountered an issue: when I decode the modified message alongside the actual message and its definition, I experience data loss and the disappearance of other fields.

Please guide on performing this task without experiencing data loss or losing other fields in the process.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions