fix JSON handling of null and optional items