variable type utility for JSON encoding