13 releases (4 breaking)

0.5.2 Dec 10, 2024
0.5.1 Dec 9, 2024
0.4.3 Dec 7, 2024
0.4.0 Nov 18, 2024
0.1.2 Nov 6, 2024

#218 in Configuration

Download history 320/week @ 2024-11-04 86/week @ 2024-11-11 397/week @ 2024-11-18 388/week @ 2024-12-02 443/week @ 2024-12-09

1,312 downloads per month

Custom license

22KB
510 lines

Żasą

License: OQL

It's just own json parser writen only in rust, with 0 external dependencies, as part of my "No dependncies" series of projects.

Usage

Easiest way to use this library is to use it with Normalize macro, however it's still pretty unstable, but it works for basic stuff. Currently it supports String, f64 and bool types

use zasa::parser::Parser;
use zasa::value::normalize;
use zasa::Normalize;

#[derive(Debug, Normalize)]
struct Example {
  name: String,
  size: f64,
  active: bool
}

fn main() {
    let json_string = "{\"name\": \"test\", \"size\": 45.0, \"active\": true}";
    let parsed = Parser::new(json_string.chars()).parse().unwrap();
    let normalized: Example = normalize(parsed).unwrap();
    dbg!(normalized);
}

it will result in

normalized = Example {
  name: "test",
  size: 45.0,
  active: true,
}

Dependencies