Skip to content

Commit

Permalink
make suggested changes related to conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
2rueSid committed Oct 23, 2023
1 parent 5b4a7b3 commit 111c5a9
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/types/json.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,15 @@ struct JsonValue {
bool is_object = val.is_object() && !val.empty();
bool is_number = val.is_number() && val.as<double>() != 0;

if (!is_number && !is_array && !is_object) {
if (is_array)
val = jsoncons::json::array();
else if (is_object)
val = jsoncons::json::object();
else if (is_number)
val = 0;
else
return;
}

if (is_array) val = jsoncons::json::array();
if (is_object) val = jsoncons::json::object();
if (is_number) val = 0;
cleared_count++;
});

Expand Down

0 comments on commit 111c5a9

Please sign in to comment.