MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / merge_patch

Function merge_patch

3rd/nlohmann_json/include/nlohmann/json.hpp:8930–8954  ·  view source on GitHub ↗

! @brief applies a JSON Merge Patch The merge patch format is primarily intended for use with the HTTP PATCH method as a means of describing a set of modifications to a target resource's content. This function applies a merge patch to the current JSON value. The function implements the following algorithm from Section 2 of [RFC 7396 (JSON Merge Patch)](https://tools.i

Source from the content-addressed store, hash-verified

8928 @since version 3.0.0
8929 */
8930 void merge_patch(const basic_json& apply_patch)
8931 {
8932 if (apply_patch.is_object())
8933 {
8934 if (!is_object())
8935 {
8936 *this = object();
8937 }
8938 for (auto it = apply_patch.begin(); it != apply_patch.end(); ++it)
8939 {
8940 if (it.value().is_null())
8941 {
8942 erase(it.key());
8943 }
8944 else
8945 {
8946 operator[](it.key()).merge_patch(it.value());
8947 }
8948 }
8949 }
8950 else
8951 {
8952 *this = apply_patch;
8953 }
8954 }
8955
8956 /// @}
8957};

Callers

nothing calls this directly

Calls 6

is_objectFunction · 0.70
eraseFunction · 0.70
beginMethod · 0.45
endMethod · 0.45
valueMethod · 0.45
keyMethod · 0.45

Tested by

no test coverage detected