diff options
Diffstat (limited to 'crates/core/c8y_translator/examples/translate_to_c8yjson.rs')
-rw-r--r-- | crates/core/c8y_translator/examples/translate_to_c8yjson.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/crates/core/c8y_translator/examples/translate_to_c8yjson.rs b/crates/core/c8y_translator/examples/translate_to_c8yjson.rs new file mode 100644 index 00000000..4bc568ce --- /dev/null +++ b/crates/core/c8y_translator/examples/translate_to_c8yjson.rs @@ -0,0 +1,27 @@ +use c8y_translator::json::from_thin_edge_json; + +fn thin_edge_translation_with_type_and_timestamp() { + let single_value_thin_edge_json_with_type_and_time = r#" { + "time" : "2013-06-22T17:03:14.100+02:00", + "temperature": 23, + "pressure": 220 + }"#; + + println!( + "\nThin_Edge_Json: \n{:#}", + single_value_thin_edge_json_with_type_and_time + ); + let output = from_thin_edge_json(single_value_thin_edge_json_with_type_and_time); + match output { + Ok(vec) => { + println!("{:?}", vec); + } + Err(e) => { + eprintln!("Error: {}", e); + } + } +} + +pub fn main() { + thin_edge_translation_with_type_and_timestamp(); +} |