-
Notifications
You must be signed in to change notification settings - Fork 0
/
basic.ino
37 lines (27 loc) · 977 Bytes
/
basic.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <Ministache.h>
/***************************************************
This is a very basic example for the ministache library
(https://github.com/floatplane/ministache).
It shows how the library can be used to render a Mustache template with a JSON object.
For more details on Mustache syntax, see http://mustache.github.io/mustache.5.html
****************************************************/
void setup() {
Serial.begin(115200);
Serial.println("");
// Create a JsonDocument instance to hold the data that we'll use in our template
JsonDocument data;
data["name"] = "World";
data["value"] = 42;
// Create a template string
String templateString = "Hello, {{name}}! The answer is {{value}}.";
// Render the template with the data
String output = ministache::render(templateString, data);
// Print the result
Serial.println(output);
// Expected output:
//
// Hello, World! The answer is 42.
}
void loop() {
delay(500);
}