Skip to content

oOBoomberOo/json_peek

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JSON Peek

JSON Peek is an amature JSON parser written for my specific need. Don't expect this to be efficient or perfect.

This library is designed to parse JSON while also keeping track of position information which can then be use inside codespan-reporting crate.

use json_peek::util;
use json_peek::value::prelude::*;
let content = r#"
{
    "display": {
        "title": "Installed Datapacks",
        "description": "",
        "icon": {
            "item": "minecraft:knowledge_book"
        },
        "background": "minecraft:textures/block/gray_concrete.png",
        "show_toast": false,
        "announce_to_chat": false
    },
    "criteria": {
        "trigger": {
             "trigger": "minecraft:tick"
        }
    }
}
"#;
let parse_result = util::from_str(content).expect("Invalid json");
let title = parse_result.get("display").get("title").expect("Title doesn't exist");

println!("Title is located at: {}", title.span);

About

A certain JSON Parser

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages