[#BloombergLP-bdljsn-Json-insert-09] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdljsn.adoc[bdljsn]::xref:BloombergLP/bdljsn/Json.adoc[Json]::insert :relfileprefix: ../../../ :mrdocs: `insert` overloads == Synopses Declared in `<bdljsn_json.h>` Insert the specified move‐insertable `member` into the `JsonObject` held by this object if the key of `member` does not already exist; otherwise, this method has no effect. Return a `pair` whose `first` member is an iterator referring to the (possibly newly inserted) `Member` object whose key matches, and whose `second` member is `true` if a new value was inserted, and `false` otherwise. `member` is left in a valid but unspecified state. If `isNull()`, then the type is changed to object. The behavior is undefined unless `isObject()` or `isNull()`, and unless `member.first` is valid UTF‐8 (see `bdlde::Utf8Util::isValid`). [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/pair-0b.adoc[bsl::pair<JsonObject::Iterator, bool>] xref:BloombergLP/bdljsn/Json/insert-064.adoc[insert](xref:BloombergLP/bslmf/MovableRef.adoc[bslmf::MovableRef<JsonObject::Member>] member); ---- [.small]#xref:BloombergLP/bdljsn/Json/insert-064.adoc[_» more..._]# Insert into the `JsonObject` held by this object members created from the specified `memberInitializers`, ignoring those whose keys already exist. Return a non‐`const` reference to this object. If `isNull()`, then the type is changed to object. The behavior is undefined unless `isObject()` or `isNull()`, and unless the keys of all members are valid UTF‐8 (see `bdlde::Utf8Util::isValid`). [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:BloombergLP/bdljsn/Json.adoc[Json]& xref:BloombergLP/bdljsn/Json/insert-0f.adoc[insert](std::initializer_list<JsonObject_MemberInitializer> memberInitializers); ---- [.small]#xref:BloombergLP/bdljsn/Json/insert-0f.adoc[_» more..._]# Insert the specified `member` into the `JsonObject` held by this object if the key of `member` does not already exist; otherwise, this method has no effect. Return a `pair` whose `first` member is an iterator referring to the (possibly newly inserted) `Member` object whose key matches, and whose `second` member is `true` if a new value was inserted, and `false` otherwise. If `isNull()`, then the type is changed to object. The behavior is undefined unless `isObject()` or `isNull()`, and unless `member.first` is valid UTF‐8 (see `bdlde::Utf8Util::isValid`). [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/pair-0b.adoc[bsl::pair<JsonObject::Iterator, bool>] xref:BloombergLP/bdljsn/Json/insert-0e5.adoc[insert](xref:BloombergLP/bdljsn/JsonObject/Member.adoc[JsonObject::Member] const& member); ---- [.small]#xref:BloombergLP/bdljsn/Json/insert-0e5.adoc[_» more..._]# Insert into the `JsonArray` held by this object at the specified `position` the specified move‐insertable `json`, and return an iterator referring to the newly inserted element. `json` is left in a valid but unspecified state. If an exception is thrown, `*this` is unaffected. Throw `bsl::length_error` if `size() == maxSize()`. The behavior is undefined unless `isArray()` and `position` is in the range `[theArray().begin() .. theArray().end()]`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:BloombergLP/bdljsn/JsonArray/Iterator-0d.adoc[JsonArray::Iterator] xref:BloombergLP/bdljsn/Json/insert-065.adoc[insert]( xref:BloombergLP/bdljsn/JsonArray/ConstIterator.adoc[JsonArray::ConstIterator] position, xref:BloombergLP/bslmf/MovableRef.adoc[bslmf::MovableRef<Json>] json); ---- [.small]#xref:BloombergLP/bdljsn/Json/insert-065.adoc[_» more..._]# Insert into the `JsonArray` held by this object at the specified `position` a copy of the specified `json`, and return an iterator referring to the newly inserted element. If an exception is thrown, `*this` is unaffected. Throw `bsl::length_error` if `size() == maxSize()`. The behavior is undefined unless `isArray()` and `position` is in the range `[theArray().begin() .. theArray().end()]`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:BloombergLP/bdljsn/JsonArray/Iterator-0d.adoc[JsonArray::Iterator] xref:BloombergLP/bdljsn/Json/insert-07.adoc[insert]( xref:BloombergLP/bdljsn/JsonArray/ConstIterator.adoc[JsonArray::ConstIterator] position, xref:BloombergLP/bdljsn/Json.adoc[Json] const& json); ---- [.small]#xref:BloombergLP/bdljsn/Json/insert-07.adoc[_» more..._]# Insert into the `JsonArray` held by this object at the specified `index` the specified move‐insertable `json`, and return an iterator referring to the newly inserted element. `json` is left in a valid but unspecified state. If `isNull()`, then the type is changed to array and `index` must be `0`. If an exception is thrown, `*this` is unaffected. Throw `bsl::length_error` if `size() == maxSize()`. The (template parameter) type `t_INDEX` must be a non‐`bool` integral type. The behavior is undefined unless `isArray()` or `isNull()`, and unless `index` is in the range `[0 .. size()]`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class t_INDEX> xref:BloombergLP/bdljsn/JsonArray/Iterator-0d.adoc[JsonArray::Iterator] xref:BloombergLP/bdljsn/Json/insert-00.adoc[insert]( t_INDEX index, xref:BloombergLP/bslmf/MovableRef.adoc[bslmf::MovableRef<Json>] json) requires bsl::is_integral<t_INDEX>::value && !bsl::is_same<t_INDEX, bool>::value; ---- [.small]#xref:BloombergLP/bdljsn/Json/insert-00.adoc[_» more..._]# Insert into the `JsonArray` held by this object at the specified `index` a copy of the specified `json`, and return an iterator referring to the newly inserted element. If `isNull()`, then the type is changed to array and `index` must be `0`. If an exception is thrown, `*this` is unaffected. Throw `bsl::length_error` if `size() == maxSize()`. The (template parameter) type `t_INDEX` must be a non‐`bool` integral type. The behavior is undefined unless `isArray()` or `isNull()`, and unless `index` is in the range `[0 .. size()]`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class t_INDEX> xref:BloombergLP/bdljsn/JsonArray/Iterator-0d.adoc[JsonArray::Iterator] xref:BloombergLP/bdljsn/Json/insert-0d.adoc[insert]( t_INDEX index, xref:BloombergLP/bdljsn/Json.adoc[Json] const& json) requires bsl::is_integral<t_INDEX>::value && !bsl::is_same<t_INDEX, bool>::value; ---- [.small]#xref:BloombergLP/bdljsn/Json/insert-0d.adoc[_» more..._]# Insert into the `JsonObject` held by this object each `Member` in the range `[first, last)]` whose key is not already present. Return a non‐`const` reference to this object. If `isNull()`, then the type is changed to object. The behavior is undefined unless `isObject()` or `isNull()`, `first` and `last` refer to a valid sequence, and the keys of all members are valid UTF‐8 (see `bdlde::Utf8Util::isValid`). [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class t_INPUT_ITERATOR> xref:BloombergLP/bdljsn/Json.adoc[Json]& xref:BloombergLP/bdljsn/Json/insert-0ec.adoc[insert]( t_INPUT_ITERATOR first, t_INPUT_ITERATOR last) requires !bsl::is_convertible<t_INPUT_ITERATOR, bsl::string_view>::value; ---- [.small]#xref:BloombergLP/bdljsn/Json/insert-0ec.adoc[_» more..._]# Insert into the `JsonObject` held by this object a `Member` constructed from the specified `key` and `value` if `key` does not already exist; otherwise, this method has no effect. Return a `pair` whose `first` member is an iterator referring to the (possibly newly inserted) `Member` object whose key matches, and whose `second` member is `true` if a new value was inserted, and `false` otherwise. If `isNull()`, then the type is changed to object. The (template parameter) type `t_STRING_VIEW` must be convertible to `bsl::string_view`. The behavior is undefined unless `isObject()` or `isNull()`, and unless `key` is valid UTF‐8 (see `bdlde::Utf8Util::isValid`). [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class t_VALUE, class t_STRING_VIEW> xref:bsl/pair-0b.adoc[bsl::pair<JsonObject::Iterator, bool>] xref:BloombergLP/bdljsn/Json/insert-03.adoc[insert]( t_STRING_VIEW const& key, t_VALUE&& value) requires !bsl::is_integral <t_STRING_VIEW>::value && bsl::is_convertible<t_STRING_VIEW, bsl::string_view>::value; ---- [.small]#xref:BloombergLP/bdljsn/Json/insert-03.adoc[_» more..._]# Insert into the `JsonArray` held by this object at the specified `position` the values in the range `[first, last)]`, and return an iterator referring to the first newly inserted element. If an exception is thrown, `*this` is unaffected. Throw `bsl::length_error` if `size() + distance(first, last) > maxSize()`. The behavior is undefined unless `isArray()` and `position` is in the range `[theArray().begin() .. theArray().end()]`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class t_INPUT_ITERATOR> xref:BloombergLP/bdljsn/JsonArray/Iterator-0d.adoc[JsonArray::Iterator] xref:BloombergLP/bdljsn/Json/insert-02.adoc[insert]( xref:BloombergLP/bdljsn/JsonArray/ConstIterator.adoc[JsonArray::ConstIterator] position, t_INPUT_ITERATOR first, t_INPUT_ITERATOR last); ---- [.small]#xref:BloombergLP/bdljsn/Json/insert-02.adoc[_» more..._]# Insert into the `JsonArray` held by this object at the specified `index` the values in the range `[first, last)]`, and return an iterator referring to the first newly inserted element. If `isNull()`, then the type is changed to array and `index` must be `0`. If an exception is thrown, `*this` is unaffected. Throw `bsl::length_error` if `size() + distance(first, last) > maxSize()`. The (template parameter) type `t_INDEX` must be a non‐`bool` integral type. The behavior is undefined unless `isArray()` or `isNull()`, and unless `index` is in the range `[0 .. size()]`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class t_INDEX, class t_INPUT_ITERATOR> xref:BloombergLP/bdljsn/JsonArray/Iterator-0d.adoc[JsonArray::Iterator] xref:BloombergLP/bdljsn/Json/insert-01.adoc[insert]( t_INDEX index, t_INPUT_ITERATOR first, t_INPUT_ITERATOR last) requires bsl::is_integral<t_INDEX>::value && !bsl::is_same<t_INDEX, bool>::value; ---- [.small]#xref:BloombergLP/bdljsn/Json/insert-01.adoc[_» more..._]# [.small]#Created with https://www.mrdocs.com[MrDocs]#