← Solana

🧩 Borsh

Encode JSON values to Borsh bytes and decode Borsh bytes back, using a schema you write as text.

Supported types

u8 u16 u32 u64 u128 i8 i16 i32 i64 i128 f32 f64 bool string pubkey bytes, vec<T>, option<T>, [T; N], struct { name: T, … }, enum { A, B(T, U), C { x: T } }. In JSON, 64-bit and larger integers can be strings, pubkey is base58, bytes is hex, an option's None is null, and an enum value is "A", {"B": [t, u]} or {"C": {"x": …}}.