[#BloombergLP-bdljsn-JsonObject-insert-032]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdljsn.adoc[bdljsn]::xref:BloombergLP/bdljsn/JsonObject.adoc[JsonObject]::insert
:relfileprefix: ../../../
:mrdocs:

`insert` overloads

== Synopses

Declared in `&lt;bdljsn&lowbar;json&period;h&gt;`

Insert the specified `member` into this `JsonObject` if the key (the `first` element) of the object referred to by `member` does not already exist in this `JsonObject`&semi; otherwise, this method has no effect&period; Return a `pair` whose `first` member is an iterator referring to the (possibly newly inserted) `member` object in this `JsonObject` whose key is the equivalent to that of the object to be inserted, and whose `second` member is `true` if a new value was inserted, and `false` otherwise&period; The behavior is undefined unless `member&period;first` is valid UTF&hyphen;8 (see `bdlde&colon;&colon;Utf8Util&colon;&colon;isValid`)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/pair-0b.adoc[bsl::pair&lt;JsonObject::Iterator, bool&gt;]
xref:BloombergLP/bdljsn/JsonObject/insert-05.adoc[insert](xref:BloombergLP/bslmf/MovableRef.adoc[bslmf::MovableRef&lt;Member&gt;] member);
----

[.small]#xref:BloombergLP/bdljsn/JsonObject/insert-05.adoc[_» more&period;&period;&period;_]#

Insert into this `JsonObject` members created (in order) from the specified `members`&period; List members having key values already contained in this object are ignored&period; Return a non&hyphen;`const` reference to this `JsonObject`&period; The behavior is undefined unless the keys of all `Member` objects inserted are valid UTF&hyphen;8 (see `bdlde&colon;&colon;Utf8Util&colon;&colon;isValid`)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bdljsn/JsonObject.adoc[JsonObject]&
xref:BloombergLP/bdljsn/JsonObject/insert-031.adoc[insert](std::initializer&lowbar;list&lt;JsonObject&lowbar;MemberInitializer&gt; memberInitializers);
----

[.small]#xref:BloombergLP/bdljsn/JsonObject/insert-031.adoc[_» more&period;&period;&period;_]#

Insert the specified `member` into this `JsonObject` if the key (the `first` element) of the object referred to by `value` does not already exist in this `JsonObject`&semi; otherwise, this method has no effect&period; Return a `pair` whose `first` member is an iterator referring to the (possibly newly inserted) `value&lowbar;type` object in this `JsonObject` whose key is equivalent to that of the object to be inserted, and whose `second` member is `true` if a new value was inserted, and `false` if a value having an equivalent key was already present&period; The behavior is undefined unless `member&period;first` is valid UTF&hyphen;8 (see `bdlde&colon;&colon;Utf8Util&colon;&colon;isValid`)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/pair-0b.adoc[bsl::pair&lt;JsonObject::Iterator, bool&gt;]
xref:BloombergLP/bdljsn/JsonObject/insert-0d.adoc[insert](xref:BloombergLP/bdljsn/JsonObject/Member.adoc[Member] const& member);
----

[.small]#xref:BloombergLP/bdljsn/JsonObject/insert-0d.adoc[_» more&period;&period;&period;_]#

Create a `Member` object for each iterator in the range starting at the specified `first` iterator and ending immediately before the specified `last` iterator, by converting from the object referred to by each iterator&period; Insert into this `JsonObject` each such object whose key is not already contained&period; Return a non&hyphen;`const` reference to this `JsonObject`&period; The (template parameter) type `t&lowbar;INPUT&lowbar;ITERATOR` shall meet the requirements of an input iterator defined in the C&plus;&plus;11 standard &lsqb;24&period;2&period;3&rsqb;providing access to values of a type convertible to `Member`&period; The behavior is undefined unless `first` and `last` refer to a sequence of value values where `first` is at a position at or before `last`&period; The behavior is undefined unless the keys of all `Member` objects inserted are valid UTF&hyphen;8 (see `bdlde&colon;&colon;Utf8Util&colon;&colon;isValid`)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class t&lowbar;INPUT&lowbar;ITERATOR&gt;
xref:BloombergLP/bdljsn/JsonObject.adoc[JsonObject]&
xref:BloombergLP/bdljsn/JsonObject/insert-0b.adoc[insert](
    t&lowbar;INPUT&lowbar;ITERATOR first,
    t&lowbar;INPUT&lowbar;ITERATOR last)
requires !bsl&colon;&colon;is&lowbar;convertible&lt;t&lowbar;INPUT&lowbar;ITERATOR, bsl&colon;&colon;string&lowbar;view&gt;&colon;&colon;value;
----

[.small]#xref:BloombergLP/bdljsn/JsonObject/insert-0b.adoc[_» more&period;&period;&period;_]#

Insert into this `JsonObject` a `Member` constructed from the specified `key` and the specified `value`, respectively, if `key` does not already exist in this `JsonObject`&semi; otherwise, this method has no effect&period; Return a `pair` whose `first` member is an iterator referring to the (possibly newly inserted) `Member` object in this `JsonObject` whose key is the equivalent to that of the object to be inserted, and whose `second` member is `true` if a new value was inserted, and `false` otherwise&period; The behavior is undefined unless `key` is valid UTF&hyphen;8 (see `bdlde&colon;&colon;Utf8Util&colon;&colon;isValid`)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class t&lowbar;VALUE&gt;
xref:bsl/pair-0b.adoc[bsl::pair&lt;JsonObject::Iterator, bool&gt;]
xref:BloombergLP/bdljsn/JsonObject/insert-01.adoc[insert](
    std::string&lowbar;view const& key,
    t&lowbar;VALUE&& value);
----

[.small]#xref:BloombergLP/bdljsn/JsonObject/insert-01.adoc[_» more&period;&period;&period;_]#


[.small]#Created with https://www.mrdocs.com[MrDocs]#
