-
-
Save piedoom/5b52920120fd6a1b8dfdea62154ee5d6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"meta": { | |
"status": 200, | |
"msg": "OK" | |
}, | |
"response": { | |
"user": { // <== only care about this object | |
"name": "name", | |
"likes": 46310, | |
... | |
// Let's pretend the User object looks like this: | |
pub struct User { | |
name: String, | |
likes: u32 | |
} | |
// Of course, when deseralized with the JSON above, we receive an error since the fields we want to access are not in the root object. | |
// is there an easier way of skipping to the "user" object besides deseralizing the whole structure? | |
// e.g. I want to avoid this: | |
pub struct response { | |
user: User | |
} | |
pub struct User { | |
// etc... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment