Encoding
JSON
JSON representation of Plutus data structures
JSON Encoding
Evolution SDK supports JSON representations of PlutusData for API interchange, debugging, and interoperability with tools that use Cardano's JSON Plutus Data format.
JSON PlutusData Format
The JSON format uses tagged objects to represent each PlutusData type:
| PlutusData Type | JSON Representation |
|---|---|
| Integer | { "int": 42 } |
| ByteArray | { "bytes": "a1b2c3" } |
| List | { "list": [...] } |
| Map | { "map": [{ "k": ..., "v": ... }] } |
| Constructor | { "constructor": 0, "fields": [...] } |
CBOR Encoding for On-Chain Use
For on-chain data (datums, redeemers), use CBOR encoding:
import { } from "@evolution-sdk/evolution"
const = .(0n, [42n, 100n])
// Encode to CBOR hex
const = .()
// Decode from CBOR hex
const = .()Next Steps
- PlutusData — On-chain data structures
- TSchema — Type-safe schema definitions
- Hex — Hex encoding for bytes