JSON 补丁文件可以加一个额外的 属性 吗?

Can an extra property be added to a JSON Patch document?

我想在 JSON 补丁文件中添加额外的 属性 label。 可以吗?

我正在使用 C# Web API,但在我的 JSON.

中没有得到 label 属性

除了将值更改为 object 之外,是否还有其他选项可以建议?

[
  { "op": "replace", "path": "/baz", "value": "boo", "label": "displayName" }
]

Is it possible to do that?

可以,但这并不意味着你应该

I am not getting the label property in my JSON.

我不知道您用来解析此类文档的 API,但此行为似乎与定义 JSON 补丁的文档 RFC 6902 一致格式(突出显示是我的):

4. Operations

Operation objects MUST have exactly one op member, whose value indicates the operation to perform. Its value MUST be one of add, remove, replace, move, copy, or test; other values are errors.

Additionally, operation objects MUST have exactly one path member. [...]

The meanings of other operation object members are defined by operation. Members that are not explicitly defined for the operation in question MUST be ignored (i.e., the operation will complete as if the undefined member did not appear in the object).