It'd do.  Indeed, VarRefValueToJson would do.
The "convert" part isn't really crucial; it's kinda implied by the "to".