Correct handling of NULL arguments in json funcs.

Per gripe from Tom Lane.