MARC-in-JSON support for record conversion utility
authorAdam Dickmeiss <adam@indexdata.dk>
Mon, 9 Dec 2013 09:57:51 +0000 (10:57 +0100)
committerAdam Dickmeiss <adam@indexdata.dk>
Mon, 9 Dec 2013 09:57:51 +0000 (10:57 +0100)
src/record_conv.c

index ff95f92..671342c 100644 (file)
@@ -388,6 +388,10 @@ static void *construct_marc(const xmlNode *ptr,
         if (!info->input_charset && info->output_charset)
             info->input_charset = "utf-8";
     }
+    else if (!strcmp(input_format, "json"))
+    {
+        info->input_format_mode = YAZ_MARC_JSON;
+    }
     else
     {
         wrbuf_printf(wr_error, "Element <marc inputformat='%s'>: "
@@ -431,6 +435,12 @@ static void *construct_marc(const xmlNode *ptr,
         if (info->input_charset && !info->output_charset)
             info->output_charset = "utf-8";
     }
+    else if (!strcmp(output_format, "json"))
+    {
+        info->output_format_mode = YAZ_MARC_JSON;
+        if (info->input_charset && !info->output_charset)
+            info->output_charset = "utf-8";
+    }
     else
     {
         wrbuf_printf(wr_error, "Element <marc outputformat='%s'>: "