-
A sample JSON object like this can validly contain null values: But the contains() method always returns false for fields of null value. How can I detect null fields in a parsed object? |
Beta Was this translation helpful? Give feedback.
Answered by
nlohmann
May 24, 2024
Replies: 1 comment 5 replies
-
j.contains("company") && j["company"].is_null() |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Your code is odd.
contains
returnstrue
if the given key is present in the object - regardless of the value.This code works for me: