Skip to content

Instantly share code, notes, and snippets.

View ShapeShapa's full-sized avatar
:shipit:
Inspecting code

shapa ShapeShapa

:shipit:
Inspecting code
View GitHub Profile
@ShapeShapa
ShapeShapa / json_to_dirs.rs
Last active October 4, 2021 05:10
generates a folder structure from a given json file
use serde_json::Value;
use std::{any, fs, path::Path};
fn parse_json_file(file: &str) -> Value {
let contents: String = fs::read_to_string(file).expect("Unable to read file");
return serde_json::from_str(&contents).unwrap();
}
fn make_dirs(json: &Value, dir: &Path) {
if let Some(i) = json.as_object() {