bug fix moment

This commit is contained in:
ouwou
2020-11-08 20:52:29 -05:00
parent 67ee799f04
commit 9fa59479aa
4 changed files with 9 additions and 6 deletions

View File

@@ -24,9 +24,13 @@ bool Snowflake::IsValid() const {
}
void from_json(const nlohmann::json &j, Snowflake &s) {
std::string tmp;
j.get_to(tmp);
s.m_num = std::stoull(tmp);
if (j.is_string()) {
std::string tmp;
j.get_to(tmp);
s.m_num = std::stoull(tmp);
} else {
j.get_to(s.m_num);
}
}
void to_json(nlohmann::json &j, const Snowflake &s) {