Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我解析 json 时,有什么方法可以区分这种情况:
my_value = "123"
和
my_value = 123
?
是的,您可以获得 JSON 值的类型。为了得到它,你需要调用QJsonValue::type()函数。在您的情况下,它将返回QJsonValue::String或QJsonValue::Double分别返回。
QJsonValue::type()
QJsonValue::String
QJsonValue::Double