Function merge_json

View as Markdown

Generated from cargo doc --no-deps -p nemo-relay -p nemo-relay-adaptive -p nemo-relay-ffi.

pub fn merge_json(a: Option<Json>, b: Option<Json>) -> Option<Json>

Shallow-merge two optional JSON values.

This is used throughout the runtime to combine optional data and metadata payloads without recursively descending into nested objects.

Parameters

  • a: Base JSON value.
  • b: Override JSON value.

Returns

An Option containing the merged JSON value. When both inputs are JSON objects, keys from b override keys from a. When only one input is present, that input is returned. When both inputs are present but at least one is not an object, b wins.

Notes

The merge is shallow. Nested objects are replaced rather than merged recursively.