map-obj
Map over the keys and values of a JSON object.
Transform the keys and/or values of a serde_json::Value object with a closure, optionally
recursing into nested objects and arrays. A faithful Rust port of the widely-used
map-obj npm package — the building block behind
key transforms like camelcase-keys.
deeprecursion (into nested objects and objects within arrays)- Skip entries, rename keys, transform values, or stop recursion per entry
__proto__keys are dropped- Differential-tested against the reference
map-objimplementation (60k cases)
Install
[]
= "0.1"
= "1"
Usage
use json;
use ;
// Rename keys:
let upper = map_obj;
assert_eq!;
// Recurse with `deep`, transform values, and drop some entries:
let result = map_obj;
assert_eq!;
Use [MapEntry::keep_without_recursing] to keep an entry but not descend into its value.
Contributors ✨
This project follows the all-contributors specification. Contributions of any kind are welcome — code, docs, bug reports, ideas, reviews! See the emoji key for how each contribution is recognized, and open a PR or issue to get involved.
Thanks goes to these wonderful people:
License
Licensed under either of MIT or Apache-2.0 at your option.