Crates.io | flatten-serde-json |
lib.rs | flatten-serde-json |
version | 0.1.0 |
source | src |
created_at | 2022-02-23 11:40:21.08802 |
updated_at | 2022-02-23 11:40:21.08802 |
description | Flatten serde-json objects like elastic search |
homepage | |
repository | https://github.com/irevoire/flatten-serde-json |
max_upload_size | |
id | 537783 |
size | 11,849 |
This crate flatten serde_json
Object
in a format
similar to elastic search.
{
"id": "287947",
"title": "Shazam!",
"release_date": 1553299200,
"genres": [
"Action",
"Comedy",
"Fantasy"
]
}
Flattens to:
{
"id": "287947",
"title": "Shazam!",
"release_date": 1553299200,
"genres": [
"Action",
"Comedy",
"Fantasy"
]
}
{
"a": {
"b": "c",
"d": "e",
"f": "g"
}
}
Flattens to:
{
"a.b": "c",
"a.d": "e",
"a.f": "g"
}
{
"a": [
{ "b": "c" },
{ "b": "d" },
{ "b": "e" },
]
}
Flattens to:
{
"a.b": ["c", "d", "e"],
}
{
"a": [
42,
{ "b": "c" },
{ "b": "d" },
{ "b": "e" },
]
}
Flattens to:
{
"a": 42,
"a.b": ["c", "d", "e"],
}
{
"a": [
"b",
["c", "d"],
{ "e": ["f", "g"] },
[
{ "h": "i" },
{ "e": ["j", { "z": "y" }] },
],
["l"],
"m",
]
}
Flattens to:
{
"a": ["b", "c", "d", "l", "m"],
"a.e": ["f", "g", "j"],
"a.h": "i",
"a.e.z": "y",
}
{
"a": {
"b": "c",
},
"a.b": "d",
}
Flattens to:
{
"a.b": ["c", "d"],
}