From ceda863e9f29f85f8d77d6fde8993e3ad67e89cf Mon Sep 17 00:00:00 2001 From: Al Date: Mon, 21 Dec 2015 17:45:06 -0500 Subject: [PATCH] [fix] Encode strings as JSON in address parser cli --- src/address_parser_cli.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/address_parser_cli.c b/src/address_parser_cli.c index 75751f1b..4e8e1570 100644 --- a/src/address_parser_cli.c +++ b/src/address_parser_cli.c @@ -8,6 +8,7 @@ #include "constants.h" #include "file_utils.h" #include "geodb.h" +#include "json_encode.h" #include "libpostal.h" #include "normalize.h" #include "scanner.h" @@ -111,7 +112,8 @@ int main(int argc, char **argv) { printf("Result:\n\n"); printf("{\n"); for (int i = 0; i < parsed->num_components; i++) { - printf(" \"%s\": \"%s\"%s\n", parsed->labels[i], parsed->components[i], i == parsed->num_components - 1 ? "," : ""); + char *json_string = json_encode_string(parsed->components[i]); + printf(" \"%s\": %s%s\n", parsed->labels[i], json_string, i < parsed->num_components - 1 ? "," : ""); } printf("}\n"); printf("\n");