#json-file #save #load #io

json_io

A tool for simplifying saving and loading serializable types to and from json files

5 unstable releases

Uses old Rust 2015

0.3.0 Mar 15, 2017
0.2.0 Jun 7, 2016
0.1.2 May 30, 2015
0.1.1 May 30, 2015
0.1.0 May 30, 2015

#1588 in Encoding

MIT license

10KB
155 lines

json_io Build Status

A tool for simplifying saving and loading serializable types to and from json files.

Supports both:

  • rustc-serialize (by default) or
  • serde with the --features="serde_serialization" --no-default-features flags.

It looks like this:


extern crate find_folder;
extern crate json_io;

fn main() {
    let test_string = "This is a json_io test!".to_owned();
    let target = find_folder::Search::Parents(1).for_folder("target").unwrap();
    let path = target.join("test");
    json_io::save(&path, &test_string).unwrap();
    let the_string: String = json_io::load(&path).unwrap();
    assert_eq!(&test_string, &the_string);
    println!("{:?}", the_string);
}

You can add it to your project by adding this to your Cargo.toml:

[dependencies]
json_io = "*"

lib.rs:

Functions for simplifying the process of serializing types to JSON files.

Supports both rustc-serialize (by default) and serde via the --features="serde_serialization" --no-default-features flags.

Dependencies

~0–365KB