Is it possible to 'flatten' properties on an object into a map like it is possible with serde #2326
Answered
by
thomas9911
thomas9911
asked this question in
Q&A
-
Is it possible to 'flatten' properties on an object into a map like it is possible with serde? #[napi(object)]
#[derive(Debug, Deserialize, Serialize)]
pub struct Schema {
pub label: String,
#[serde(flatten)]
pub other: serde_json::Map<String, serde_json::Value>,
} Here label will be directly on the struct/object but other properties will be put in the other map |
Beta Was this translation helpful? Give feedback.
Answered by
thomas9911
Oct 24, 2024
Replies: 1 comment
-
found the solution in the docs (I dont know why I didnt read this before?) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
thomas9911
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
found the solution in the docs (I dont know why I didnt read this before?)
https://docs.rs/napi/latest/napi/index.html#serde-json