arbitrary-json 0.1.1

A Json generator based on serde_json and arbitrary
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use std::io::Read;

use arbitrary_json::ArbitraryValue;
use serde_json::Value;

fn main() {
    let mut input = Vec::new();
    std::io::stdin().read_to_end(&mut input).unwrap();

    let mut unstructured = arbitrary::Unstructured::new(&input);
    let json: ArbitraryValue = unstructured.arbitrary().unwrap();
    let json: Value = json.into();
    let json = serde_json::to_string_pretty(&json).unwrap_or_else(|_| json.to_string());

    println!("{}", json);
}