Insert a copy of json at index in the held array.

Synopsis

Declared in <bdljsn_json.h>

template<class t_INDEX>
JsonArray::Iterator
insert(
    t_INDEX index,
    Json const& json)
requires bsl::is_integral<t_INDEX>::value
                        && !bsl::is_same<t_INDEX, bool>::value;

Description

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()].

Return Value

an iterator referring to the newly inserted element

Parameters

Name

Description

index

insertion position

json

value to insert

Created with MrDocs