serde_rison 0.1.1

A serde implementation for the RISON data format
Documentation

serde_rison

A serde implementation for the RISON data format.

Heavily inspired by David Tolnay's serde_json. RISON is structurally similar to JSON, so much of the architecture carries over. This was a quick project for company's needs so I'm not planning on implementing generic Serializer over W: io::Write + Formatter, although if there is need on our side I'll convert it.

What's different from serde_json

  • No Writer / Formatter abstraction: just a plain to_string / from_str interface
  • No io::Write support: serialization builds a String in memory
  • No pretty-printing
  • No to_value yet

Usage

use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug, PartialEq)]
struct Person {
    name: String,
    age: u32,
    active: bool,
}

let person = Person {
    name: "John".into(),
    age: 30,
    active: true,
};

// Serialize
let rison = serde_rison::to_string(&person).unwrap();
assert_eq!(rison, "(name:John,age:30,active:!t)");

// Deserialize
let back: Person = serde_rison::from_str(&rison).unwrap();
assert_eq!(person, back);