Serializza BSON

Codifica documenti JSON in BSON binario scaricabile.

Input: TestoRisultato: Byte binari

Inserimento di testo

Esempi

A compact feature-flag record

Input

{"compact":true,"schema":0}

Expected answer

Hexadecimal bytes
1b 00 00 00 08 63 6f 6d 70 61 63 74 00 01 10 73 63 68 65 6d 61 00 00 00 00 00 00
A UTF-8 café label

Input

{"name":"café","city":"Paris"}

Expected answer

Hexadecimal bytes
25 00 00 00 02 6e 61 6d 65 00 06 00 00 00 63 61 66 c3 a9 00 02 63 69 74 79 00 06 00 00 00 50 61 72 69 73 00 00
A negative sensor reading

Input

{"station":"demo","celsius":-12}

Expected answer

Hexadecimal bytes
24 00 00 00 02 73 74 61 74 69 6f 6e 00 05 00 00 00 64 65 6d 6f 00 10 63 65 6c 73 69 75 73 00 f4 ff ff ff 00
A decimal checkout amount

Input

{"amount":12.5,"currency":"EUR"}

Expected answer

Hexadecimal bytes
27 00 00 00 01 61 6d 6f 75 6e 74 00 00 00 00 00 00 00 29 40 02 63 75 72 72 65 6e 63 79 00 04 00 00 00 45 55 52 00 00
A missing avatar

Input

{"user":"demo","avatar":null}

Expected answer

Hexadecimal bytes
1c 00 00 00 02 75 73 65 72 00 05 00 00 00 64 65 6d 6f 00 0a 61 76 61 74 61 72 00 00
A nested configuration

Input

{"server":{"port":443,"tls":true}}

Expected answer

Hexadecimal bytes
22 00 00 00 03 73 65 72 76 65 72 00 15 00 00 00 10 70 6f 72 74 00 bb 01 00 00 08 74 6c 73 00 01 00 00
basic

Input

{"hello":"world"}

Expected answer

Hexadecimal bytes
16 00 00 00 02 68 65 6c 6c 6f 00 06 00 00 00 77 6f 72 6c 64 00 00

Strumenti correlati

Riordino del codice

Riferimento dell’operazione

Vedi la documentazione tecnica originale (English)