# `serde_v8vs`
`serde` support for V8's `ValueSerializer` format (used by Node.js/Deno's [Serialization API](https://nodejs.org/api/v8.html#serialization-api)) so you can easily send data between Rust & JS without resorting to JSON or non-native encoders/decoders.
## Compatibility
Supports format versions 13-16 (Node.js v8.x+ and any Deno version that supports `ValueSerializer`). Serialization outputs version 15 (Node.js v18+) by default, but this can be configured.
⚠️ **This crate does not support host objects**, which Node.js/Deno's default `serialize` function (backed by `DefaultSerializer`) uses to serialize typed arrays. When serializing in JS, you *must* create a **blank serializer**:
```ts
// ❌ - won't work with `serde_v8vs`
import { serialize } from 'node:v8';
const bytes = serialize(new Uint8Array([ 1, 2, 3 ]));
```
```ts
// ✅ - will work everywhere
import { Serializer } from 'node:v8';
function compatSerialize(value: any): Uint8Array {
const serializer = new Serializer();
serializer.writeHeader();
serializer.writeValue(value);
return serializer.releaseBuffer();
}
const bytes = compatSerialize(new Uint8Array([ 1, 2, 3 ]));
```
## Supported external types
- [`serde_bytes`](https://docs.rs/serde_bytes)
- [`jiff`](https://docs.rs/jiff)
- Supports `jiff::Timestamp`, requires Cargo feature
- **`v0.2`**: `features = [ "jiff-0_2" ]`
- [`chrono`](https://docs.rs/chrono)
- Supports `chrono::DateTime<Utc>`, requires Cargo feature
- **`v0.4`**: `features = [ "chrono-0_4" ]`