Function toNonEmptyJSONObject

Returns x if x is a plain object and has at least one key with non-undefined value, otherwise returns undefined.