| 103 | } |
| 104 | |
| 105 | bool json_to_bool(const char *buffer, const jsmntok_t *tok, bool *b) |
| 106 | { |
| 107 | if (tok->type != JSMN_PRIMITIVE) |
| 108 | return false; |
| 109 | if (memeqstr(buffer + tok->start, tok->end - tok->start, "true")) { |
| 110 | *b = true; |
| 111 | return true; |
| 112 | } |
| 113 | if (memeqstr(buffer + tok->start, tok->end - tok->start, "false")) { |
| 114 | *b = false; |
| 115 | return true; |
| 116 | } |
| 117 | return false; |
| 118 | } |
| 119 | |
| 120 | |
| 121 | bool json_tok_is_num(const char *buffer, const jsmntok_t *tok) |