#json-text #text #json #convert-text #rust

程序+库 text-to-json

Rust中将文本转换为json

4个版本

0.1.3 2019年11月3日
0.1.2 2019年11月2日
0.1.1 2019年10月24日
0.1.0 2019年10月24日

文本处理 中排名 1274

Download history

每月下载 502

MIT 许可证

5KB
74 代码行

text-to-json

Rust中将文本转换为json。

安装

[dependencies]
text-to-json = "0.1.3"

如何使用?

请查看 main.rs

extern crate text_to_json;

use text_to_json::read;

fn main() {
  match read::to_json(String::from("example.txt")) {
    Ok(content) => println!("{:?}", content),
    Err(_) => panic!("Error"),
  }
}

请查看 example.txt

// output
["{\"title\":\"hello world\"}", "{\"description\":\"lorem ipsume sit amet dolor\"}", "{\"date\":\"1211121\"}"]

依赖项

~0.5–1MB
~20K SLoC