added emptiness check for json objects