Better JSON transform. Circumvents JSON error if value is nil.