create a json string from a table */
| 26 | create a json string from a table |
| 27 | */ |
| 28 | static String json_format(const json_table_t *table, uint8_t n) |
| 29 | { |
| 30 | String s = "{"; |
| 31 | for (uint8_t i=0; i<n; i++) { |
| 32 | const auto &t = table[i]; |
| 33 | s += "\"" + t.name + "\" : "; |
| 34 | s += "\"" + escape_string(t.value) + "\""; |
| 35 | if (i != n-1) { |
| 36 | s += ","; |
| 37 | } |
| 38 | } |
| 39 | s += "}"; |
| 40 | return s; |
| 41 | } |
| 42 | |
| 43 | typedef struct { |
| 44 | int v; |
no test coverage detected