@@ -152,20 +152,23 @@ func toListWorkflowResponse(ws WorkflowStatus) (map[string]any, error) {
152152 result ["StartedAt" ] = nil
153153 }
154154
155- if ws .Input != nil && ws .Input != "" {
156- bytes , err := json .Marshal (ws .Input )
157- if err != nil {
158- return nil , fmt .Errorf ("failed to marshal input: %w" , err )
155+ if ws .Input != nil {
156+ // If there is a value, it should be a JSON string
157+ jsonInput , ok := ws .Input .(string )
158+ if ok {
159+ result ["Input" ] = jsonInput
160+ } else {
161+ result ["Input" ] = ""
159162 }
160- result ["Input" ] = string (bytes )
161163 }
162164
163- if ws .Output != nil && ws .Output != "" {
164- bytes , err := json .Marshal (ws .Output )
165- if err != nil {
166- return nil , fmt .Errorf ("failed to marshal output: %w" , err )
165+ if ws .Output != nil {
166+ jsonOutput , ok := ws .Output .(string )
167+ if ok {
168+ result ["Output" ] = jsonOutput
169+ } else {
170+ result ["Output" ] = ""
167171 }
168- result ["Output" ] = string (bytes )
169172 }
170173
171174 if ws .Error != nil {
@@ -439,15 +442,16 @@ func newAdminServer(ctx *dbosContext, port int) *adminServer {
439442 "child_workflow_id" : step .ChildWorkflowID ,
440443 }
441444
442- // Marshal Output as JSON string if present
443- if step . Output != nil && step . Output != "" {
444- bytes , err := json . Marshal ( step .Output )
445- if err != nil {
446- ctx . logger . Error ( "Failed to marshal step output", "error" , err )
447- http . Error ( w , fmt . Sprintf ( "Failed to format step output: %v" , err ), http . StatusInternalServerError )
448- return
445+ if step . Output != nil {
446+ // If there is a value, it should be a JSON string
447+ jsonOutput , ok := step .Output .( string )
448+ if ok {
449+ formattedStep [ " output"] = jsonOutput
450+ } else {
451+ formattedStep [ "output" ] = ""
449452 }
450- formattedStep ["output" ] = string (bytes )
453+ } else {
454+ formattedStep ["output" ] = ""
451455 }
452456
453457 // Marshal Error as JSON string if present
0 commit comments