pub fn decode_schema(encoded: &str, pretty: bool) -> Result<String, SchemaError>Expand description
Decode schema format to JSON: framed → display96 → [decompress] → binary → IR → JSON
Reverses the schema encoding pipeline to reconstruct the original JSON from the framed, display-safe wire format. Automatically detects and handles compression.
§Arguments
encoded- Schema-encoded string with delimiters (𓍹...𓍺)pretty- Pretty-print JSON output with indentation
§Returns
Returns the decoded JSON string (minified or pretty-printed)
§Errors
SchemaError::InvalidFrame- Missing or invalid frame delimitersSchemaError::InvalidCharacter- Invalid character in display96 payloadSchemaError::Decompression- Decompression failureSchemaError::UnexpectedEndOfData- Truncated or corrupted binary dataSchemaError::InvalidTypeTag- Invalid type tag in header
§Example
ⓘ
use base_d::decode_schema;
let encoded = "𓍹╣◟╥◕◝▰◣◥▟╺▖◘▰◝▤◀╧𓍺";
// Minified output
let json = decode_schema(encoded, false)?;
println!("{}", json); // {"users":[{"id":1,"name":"alice"}]}
// Pretty-printed output
let pretty = decode_schema(encoded, true)?;
println!("{}", pretty);
// {
// "users": [
// {"id": 1, "name": "alice"}
// ]
// }§See Also
encode_schema- Encode JSON to schema format- SCHEMA.md - Full format specification