[#BloombergLP-bdljsn-Json-insert-03]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdljsn.adoc[bdljsn]::xref:BloombergLP/bdljsn/Json.adoc[Json]::insert
:relfileprefix: ../../../
:mrdocs:

Insert into the `JsonObject` held by this object a `Member` constructed from the specified `key` and `value` if `key` does not already exist&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 whose key matches, and whose `second` member is `true` if a new value was inserted, and `false` otherwise&period; If `isNull()`, then the type is changed to object&period; The (template parameter) type `t&lowbar;STRING&lowbar;VIEW` must be convertible to `bsl&colon;&colon;string&lowbar;view`&period; The behavior is undefined unless `isObject()` or `isNull()`, and unless `key` is valid UTF&hyphen;8 (see `bdlde&colon;&colon;Utf8Util&colon;&colon;isValid`)&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class t&lowbar;VALUE,
    class t&lowbar;STRING&lowbar;VIEW&gt;
xref:bsl/pair-0b.adoc[bsl::pair&lt;JsonObject::Iterator, bool&gt;]
insert(
    t&lowbar;STRING&lowbar;VIEW const& key,
    t&lowbar;VALUE&& value)
requires !bsl&colon;&colon;is&lowbar;integral   &lt;t&lowbar;STRING&lowbar;VIEW&gt;&colon;&colon;value
                          &amp;&amp; bsl&colon;&colon;is&lowbar;convertible&lt;t&lowbar;STRING&lowbar;VIEW,
                                                 bsl&colon;&colon;string&lowbar;view&gt;&colon;&colon;value;
----


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