Skip to content

is<char*>() should return true for null #330

@gerikintercede

Description

@gerikintercede

There is no way to test for "key":null in a JsonVariant.
JsonVariant().is< char* >() returns false as expected, so is no use.
JsonVariant().asString() returns NULL, but it will also return NULL for "key":1, so is no use.

Needs something like:

inline bool JsonVariant::isNull() const {
  using namespace Internals;
  return (_type == JSON_UNPARSED && _content.asString &&
      !strcmp("null", _content.asString));
}

However, this also needs bool JsonVariant::is< void* >();, or possibly class JsonNull; bool JsonVariant::is< JsonNull >();

Also there are no tests in JsonVariant_As_Tests.cpp and JsonVariant_Is_Tests.cpp for "key":null .

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions