json-read

Crates.iojson-read
lib.rsjson-read
version1.0.1
created_at2025-09-02 09:00:35.117296+00
updated_at2025-09-02 09:06:51.288234+00
descriptionjson-read是一个json读取工具,可以直接通过`x.y.z.w`方式读取json中的内容,不用逐层解析
homepage
repositoryhttps://gitee.com/ranfusheng/json-reader.git
max_upload_size
id1820853
size14,559
(TheoryDance)

documentation

https://gitee.com/ranfusheng/json-reader.git

README

json-read

介绍

json-read是一个json读取工具,可以直接通过x.y.z.w方式读取json中的内容,不用逐层解析

使用示例

use json_read::JsonWrapper;

#[test]
fn test_config_util() {
    let wrapper = JsonWrapper::new("docs/config.json").unwrap(); // json配置
    // let warpper = JsonWrapper::from_string("......").unwrap();

    // 注意: 这里面的children是一个数组,不管是数组还是对象,都是通过点来操作
    let x = wrapper.get("address.children.name");
    // address.children.name = [String("r"), String("s")]
    println!("address.children.name = {:?}", x);
    println!("=============================================================");

    // 作为配置使用,正常是知晓需要
    let x = wrapper.get_one("address.x.y").as_str().unwrap();
    // address.x.y = hello, json!
    println!("address.x.y = {}", x);
}

安装教程

cargo add json-read
Commit count: 0

cargo fmt