2 releases

0.0.2 Jun 19, 2023
0.0.1 Jun 18, 2023

#1821 in Development tools

MIT/Apache

8KB

README

crates.io docs.rs github

jsonerr2array help to transform jsonerr to array json

Usage

use jsonerr2array::*;
fn main() {
    let result = jsonerr2array(&serde_json::json!({
        "meta": {},
        "iserr": true,
        "err": {
            "code": "ERR001",
            "message": "message",
            "payload": { "payload" : 1 },
            "origin": {
                "meta": {},
                "iserr": true,
                "err": {
                    "code": "ERR002",
                    "message": "message",
                    "payload": { "payload" : 2 }
                }
            }
        }
    }));
    println!("{:#?}", myjson);
}

return

[
    {
        "meta": {},
        "iserr": true,
        "err": {
            "code": "ERR001",
            "message": "message",
            "payload": { "payload" : 1 }
        }
    },
    {
        "meta": {},
        "iserr": true,
        "err": {
            "code": "ERR002",
            "message": "message",
            "payload": { "payload" : 2 }
        }
    }
]

Examples

  • cargo run --example basic

Dependencies

~0.7–1.6MB
~34K SLoC