json-checker 0.1.1

a wrapper around JSON-c
Documentation
  • Coverage
  • 0%
    0 out of 17 items documented0 out of 5 items with examples
  • Size
  • Source code size: 47.49 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 742.69 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 12s Average build duration of successful builds.
  • all releases: 12s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • zTgx

json-checker Build Status crate

A wrapper around JSON-c, a light-weight json checker by Douglas Crockford .

Usage

Add dependencies

[dependencies]
json-checker = "0.1.0"
extern crate json_checker;
use json_checker::*;

extern crate ncurses;
use ncurses::*;

fn main() {
    let mut checker = JsonChecker::new(20);

    initscr();
    raw();

    keypad(stdscr(), true);

    printw("Enter a json string: ");

    loop {
        let next_char = getch();
        if next_char == 0xa {
            endwin();
            break;
        }

        if checker.check_char(next_char) == 0 {
            endwin();
            panic!("JSON_checker_end: syntax error\n");
        }
    }

    if checker.done() == 0 {
        panic!("JSON_checker_end: syntax error\n");
    } else {
        println!("well-formed JSON text!")
    }
}