Corrected isNonEmptyJson function and added test for it