From a1eb71c056809b218ce8dfc16261d86936e2bee2 Mon Sep 17 00:00:00 2001 From: imwhocodes Date: Sat, 21 Nov 2020 01:00:08 +0100 Subject: [PATCH] added integer key and unsigned key to sax_parser, defaulted to key string --- include/nlohmann/detail/input/json_sax.hpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/nlohmann/detail/input/json_sax.hpp b/include/nlohmann/detail/input/json_sax.hpp index 223acd60e..bcc4a98a1 100644 --- a/include/nlohmann/detail/input/json_sax.hpp +++ b/include/nlohmann/detail/input/json_sax.hpp @@ -95,6 +95,26 @@ struct json_sax */ virtual bool key(string_t& val) = 0; + /*! + @brief an object key was read + @param[in] val object integer key + @return whether parsing should proceed + @note default to key(string_t& val) if no overload provided + */ + virtual bool key(number_integer_t val){ + return key(std::to_string(val)); + } + + /*! + @brief an object key was read + @param[in] val object unsigned key + @return whether parsing should proceed + @note default to key(string_t& val) if no overload provided + */ + virtual bool key(number_unsigned_t val){ + return key(std::to_string(val)); + } + /*! @brief the end of an object was read @return whether parsing should proceed