# XO0432: `to:` or `from:` names no function of the module

A type with its own JSON form travels as P: encoding calls `to` to make the P, decoding decodes a P and calls `from`. Both are plain functions declared in the type's module, not methods, not generic, and not imported from another module, so the conversion lives beside the type. Declare the function, or fix its name. See core 2.3 and decision 0478.

## Example

```xo
struct Money {
  minor: Int
} derive Json(via: Int, to: money_minor, from: money_of)

fn money_of(n: Int) -> Money { Money{minor: n} }
```

## Fix

```xo
struct Money {
  minor: Int
} derive Json(via: Int, to: money_minor, from: money_of)

fn money_minor(m: Money) -> Int { m.minor }

fn money_of(n: Int) -> Money { Money{minor: n} }
```

Run `xo explain XO0432` for this text in a terminal, or see
[section 10.6 of the specification](../../spec/core/#106-diagnostic-codes).

