---
title: "unsupported-marshal-type"
description: "Detect channels and functions passed to JSON or XML marshaling."
image: "https://strider.gempir.com/og.png"
---

> Documentation Index
> Fetch the complete documentation index at: https://strider.gempir.com/llms.txt
> Use this file to discover all available pages before exploring further.

# unsupported-marshal-type

**Default severity:** `error`

The standard JSON and XML encoders cannot marshal channel or function values.
The check recursively checks exported fields, while honoring ignored
fields and custom marshaling methods.

## Bad

```go
json.Marshal(make(chan int))
```

## Good

```go
json.Marshal(struct{ Name string }{Name: name})
```

Source: https://strider.gempir.com/analyzers/unsupported-marshal-type/index.mdx
