Docs.rs
  • json-toolkit-0.1.1
    • json-toolkit 0.1.1
    • Permalink
    • Docs.rs crate page
    • MIT
    • Links
    • Homepage
    • Repository
    • crates.io
    • Source
    • Owners
    • alekece
    • Dependencies
      • derive_more ^0.99.17 normal
      • json ^0.12.4 normal optional
      • serde ^1.0.144 normal optional
      • serde_json ^1.0.85 normal optional
      • thiserror ^1.0.32 normal
    • Versions
    • 72.73% of the crate is documented
  • Platform
    • i686-pc-windows-msvc
    • i686-unknown-linux-gnu
    • x86_64-apple-darwin
    • x86_64-pc-windows-msvc
    • x86_64-unknown-linux-gnu
  • Feature flags
  • docs.rs
    • About docs.rs
    • Privacy policy
  • Rust
    • Rust website
    • The Book
    • Standard Library API Reference
    • Rust by Example
    • The Cargo Guide
    • Clippy Documentation

Crate json_toolkit

json_toolkit0.1.1

  • All Items

Sections

  • json-toolkit
    • Features

Crate Items

  • Structs
  • Enums
  • Traits

Crates

  • json_toolkit

Crate json_toolkit

Source
Expand description

§json-toolkit

The json-toolkit crate exposes all the common manipulation/validation operation expected from a JSON pointer and support several JSON value representation :

  • Encode RFC6901 representation in Pointer type.
  • Manipulate any JSON value by a JSON pointer.
use json_toolkit::{ValueExt, Pointer};
use serde_json::{Value, json};

let mut json = json!({ "foo": "bar", "zoo": { "id": 1 } });

json.insert_at(&Pointer::new("/zoo/new_field").unwrap(), "new_value").unwrap();
assert_eq!(json, json!({ "foo": "bar", "zoo": { "id": 1, "new_field": "new_value" } }));

let old_value = json.insert("foo".to_string(), 42).unwrap();
assert_eq!(old_value, Some("bar".into()));
assert_eq!(json, json!({ "foo": 42, "zoo": { "id": 1, "new_field": "new_value" } }));

let id = ValueExt::pointer(&json, &Pointer::new("/zoo/id").unwrap());
assert_eq!(id, Some(&1.into()));

§Features

json-toolkit supports several JSON value representation, and has features that may be enabled or disabled :

  • serde: Enable serde {de}serialization on Pointer type and implement ValueExt on serde_json::Value type.
  • json: Implement ValueExt on json::JsonValue type.

Structs§

Pointer
JSON pointer representation based on RFC6901.

Enums§

Error
Any error that may occur when using this crate.

Traits§

ValueExt
An extension trait for any JSON value representation that provides a variety of manipulation methods.

Results

Settings
Help
    trait
    json_toolkit::ValueExt
    An extension trait for any JSON value representation that …
No results :(
Try on DuckDuckGo?

Or try looking in one of these:
  • The Rust Reference for technical details about the language.
  • Rust By Example for expository code examples.
  • The Rust Book for introductions to language features and the language itself.
  • Docs.rs for documentation of crates released on crates.io.
No results :(
Try on DuckDuckGo?

Or try looking in one of these:
  • The Rust Reference for technical details about the language.
  • Rust By Example for expository code examples.
  • The Rust Book for introductions to language features and the language itself.
  • Docs.rs for documentation of crates released on crates.io.