json: make json_add_string do partial escapes.

This is useful when we log a JSON-escaped string, so we don't double-escape.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2018-03-26 10:38:47 +10:30
parent ed9093fcbd
commit 7ae013202f
7 changed files with 87 additions and 17 deletions

View File

@@ -76,7 +76,7 @@ void json_object_end(struct json_result *ptr);
struct json_result *new_json_result(const tal_t *ctx);
/* '"fieldname" : "value"' or '"value"' if fieldname is NULL. Turns
* any unusual chars into ?.
* any non-printable chars into JSON escapes, but leaves existing escapes alone.
*/
void json_add_string(struct json_result *result, const char *fieldname, const char *value);