Skip to content

Instantly share code, notes, and snippets.

@lupyuen

lupyuen/parse-json.rs

Last active Aug 26, 2019
Embed
What would you like to do?
macro_rules! parse {
...
(@$enc:ident @object $obj:ident [$($key:tt)+] ($value:expr) , $($rest:tt)*) => {
d!(adding key: $($key)+ value: $value to object: $obj);
// Append the key and value to the "values" array e.g.
// {"key":"device", "value":"010203"},
$crate::coap_item_str!(@$enc $obj, $($key)+, $value);
// Continue parsing the rest of the JSON.
$crate::parse!(@$enc @object $obj () ($($rest)*) ($($rest)*));
};
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.