41 {
42 constexpr auto n = glm_component_count<T>();
43 if (!j.is_array()) {
44 throw nlohmann::json::type_error::create(302, "expected array for glm type", &j);
45 }
46
47 if (j.size() != n) {
48 throw nlohmann::json::other_error::create(501,
49 "glm component count mismatch: expected "
50 + std::to_string(n) + ", got " + std::to_string(j.size()),
51 &j);
52 }
53
54 using Comp = glm_component_type<T>;
56 for (size_t i = 0; i < n; ++i)
57 ptr[i] = j[i].get<Comp>();
58 }