12 #include <nlohmann/json.hpp>
16 template<
class Jsonish,
class Key,
class Func>
20 && std::invoke(std::forward<Func>(f), std::forward<Jsonish>(j)[std::forward<Key>(k)]);
28 || (j.is_number_integer()
29 && j.template get<long long>() <= 9007199254740991LL
30 && j.template get<long long>() >= -9007199254740991LL)
35 template<
class Jsonish,
class RangeT>
36 std::optional<std::decay_t<Jsonish>>
getInJson(Jsonish &&j,
RangeT &&path, std::size_t index = 0)
38 if (index >= path.size()) {
39 return std::forward<Jsonish>(j);
42 auto currentSegment = path[index];
43 if (j.is_object() && j.contains(currentSegment)) {
44 return getInJson(std::forward<Jsonish>(j)[currentSegment], std::forward<RangeT>(path), index + 1);