<p><code>BuiltinString</code> has no <code>ToData</code> instance so it cannot be used as Datum. One option is to <code>encodeUtf8</code> and use the <code>BuiltinByteString</code>. Not sure why you want to use JSON though.</p>

CC BY-SA 4.0
2023-03-08T09:25:20.540Z
2023-03-08T09:25:20.540Z
james
<p>I would like to include a <code>BuiltinString</code> in a datum but am unable to do so as <code>BuiltinString</code> has neither a <code>FromJSON</code> nor a <code>ToJSON</code> instance. Is there an alternative to implementing these instances by hand?</p>

<plutus><script><datum><on-chain>
Unable to convert BuiltinString to JSON
# Unable to convert BuiltinString to JSON

(Asked by: username_0 on 2023-03-07)

I would like to include a `BuiltinString` in a datum but am unable to do so as `BuiltinString` has neither a `FromJSON` nor a `ToJSON` instance. Is there an alternative to implementing these instances by hand?

**Tags:** plutus, script, datum, on-chain

---

## 1 answers

### Answer by username_1 on 2023-03-08. Score: 1 | Accepted answer

`BuiltinString` has no `ToData` instance so it cannot be used as Datum. One option is to `encodeUtf8` and use the `BuiltinByteString`. Not sure why you want to use JSON though.


---

