decamelize-keys
Convert the keys of a JSON object from camelCase to a separated lower-case form.
{ "fooBar": 1 } → { "foo_bar": 1 }. A faithful Rust port of the
decamelize-keys npm package, operating on
[serde_json::Value] and built on the
decamelize crate. It is the inverse of
camelcase-keys.
deep, customseparator, andexcludeoptions- Differential-tested against the reference
decamelize-keysimplementation (60k cases)
Install
[]
= "0.1"
= "1"
Usage
use json;
use ;
assert_eq!;
// Recurse into nested objects and arrays:
assert_eq!;
// Custom separator, or exclude keys:
assert_eq!;
let _ = decamelize_keys_with;
The exclude option compares against the original keys.
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.