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

Insert a member constructed from `key` and `value` if `key` is new&period;

== Synopsis

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

[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;]
insert(
    std::string&lowbar;view const& key,
    t&lowbar;VALUE&& value);
----

== Description

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;

== Return Value

a pair of an iterator to the element and a `bool` that is `true` if inserted

== Parameters

[cols="1,4"]
|===
| Name| Description
| *key*
| UTF&hyphen;8 member name
| *value*
| member value
|===


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