mirror of
https://github.com/nlohmann/json.git
synced 2026-08-04 20:39:01 +00:00
Conversions whose element count is fixed by the destination C++ type -- `std::pair`, `std::tuple`, `std::array<T, N>`, C arrays, and `std::map`/`std::unordered_map` with a non-string key -- read exactly the elements they need via `at` and never compare the JSON array's size to that number. Excess elements are silently discarded, while a shortfall throws `out_of_range.401` rather than a `type_error`. Neither direction was documented in `conversions.md`, `get.md`, or `from_json.md`. The existing warning covered only `std::array` and stated that a too-short JSON array leaves the remaining elements default-constructed with no exception thrown; that is not what happens. Generalize it to all fixed-size destinations and correct the shortfall direction. Signed-off-by: Niels Lohmann <mail@nlohmann.me>