MARC-in-JSON support for record conversion utility
[yaz-moved-to-github.git] / 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";
     }
         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'>: "
     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";
     }
         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'>: "
     else
     {
         wrbuf_printf(wr_error, "Element <marc outputformat='%s'>: "