extract_jsons_from_string 0.1.3

A library to extract valid JSONs from a string to a vector
Documentation
  • Coverage
  • 100%
    2 out of 2 items documented1 out of 1 items with examples
  • Size
  • Source code size: 4.08 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.03 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • at-75/extract_jsons_from_string
    1 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • at-75

About

extract_json_from_string is library to extract valid JSONs from a string and store them in an vector

Usage

use extract_jsons_from_string::extract;

fn main() { 

    let data = r#"sample text before json {
     "name": "Abigail",
     "age": 34,
     "isMarried": true,
     "hobbies": ["reading", "gardening"]
    } sample text after json
    {
     "name": "Morris",
     "age": 45,
     "isMarried": false,
     "hobbies": ["cycling", "swimming"]
    } sample text after json
    "#;

    let v: Vec<String> = extract(data);

    // Output : {"name":"Abigail","age":34,"isMarried":true,"hobbies":["reading","gardening"]}
    //           {"name":"Morris","age":45,"isMarried":false,"hobbies":["cycling","swimming"]}  

    for s in &v {
        println!("{}", s);
    }
}