go-simplejson icon indicating copy to clipboard operation
go-simplejson copied to clipboard

How to test if the value is NULL?

Open jokaorgua opened this issue 2 years ago • 1 comments

Hello.

is there any way to test the value for NULL?

Assume we have a json

{"someid":null}

And I want to test if the value is null, not just empty. For testing it as empty I can do something like require.Empty(simplejsonData.Get("someid"))

Any help is appreciated.

jokaorgua avatar May 24 '22 06:05 jokaorgua

oh. finally found. require.Nil(simplejson.Get("someid").Interface())

Seems to me would be nice to have a special method like simplejson.MustNull()

jokaorgua avatar May 24 '22 06:05 jokaorgua