| 1896 | } |
| 1897 | |
| 1898 | struct listpeers_result *json_to_listpeers_result(const tal_t *ctx, |
| 1899 | const char *buffer, |
| 1900 | const jsmntok_t *toks) |
| 1901 | { |
| 1902 | size_t i; |
| 1903 | const jsmntok_t *iter; |
| 1904 | struct listpeers_result *res; |
| 1905 | const jsmntok_t *peerstok = json_get_member(buffer, toks, "peers"); |
| 1906 | |
| 1907 | if (peerstok == NULL || peerstok->type != JSMN_ARRAY) |
| 1908 | return NULL; |
| 1909 | |
| 1910 | res = tal(ctx, struct listpeers_result); |
| 1911 | res->peers = tal_arr(res, struct listpeers_peer *, 0); |
| 1912 | |
| 1913 | json_for_each_obj(i, iter, peerstok) { |
| 1914 | struct listpeers_peer *p = |
| 1915 | json_to_listpeers_peer(res, buffer, iter); |
| 1916 | if (p == NULL) |
| 1917 | return tal_free(res); |
| 1918 | tal_arr_expand(&res->peers, p); |
| 1919 | } |
| 1920 | return res; |
| 1921 | } |
| 1922 | |
| 1923 | struct createonion_response *json_to_createonion_response(const tal_t *ctx, |
| 1924 | const char *buffer, |
no test coverage detected