Rework FnCallFold to use ConvertVarRefToJson and sorting helpers