diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp index 8e2de8375f..053be8f744 100644 --- a/include/nlohmann/json.hpp +++ b/include/nlohmann/json.hpp @@ -6072,6 +6072,9 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec for (auto it = first; it != last; ++it) { m_value.object->operator[](it.key()) = it.value(); +#if JSON_DIAGNOSTICS + m_value.object->operator[](it.key()).m_parent = this; +#endif } } diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 4bae31ac90..803a83c394 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -23477,6 +23477,9 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec for (auto it = first; it != last; ++it) { m_value.object->operator[](it.key()) = it.value(); +#if JSON_DIAGNOSTICS + m_value.object->operator[](it.key()).m_parent = this; +#endif } }