[GRASS-SVN] r74448 - grass/branches/releasebranch_7_6/vector/v.what

svn_grass at osgeo.org svn_grass at osgeo.org
Wed May 1 14:48:02 PDT 2019


Author: mmetz
Date: 2019-05-01 14:48:02 -0700 (Wed, 01 May 2019)
New Revision: 74448

Modified:
   grass/branches/releasebranch_7_6/vector/v.what/what.c
Log:
v.what: fix JSON output format by escaping " (backport trunk r74048)

Modified: grass/branches/releasebranch_7_6/vector/v.what/what.c
===================================================================
--- grass/branches/releasebranch_7_6/vector/v.what/what.c	2019-05-01 20:46:57 UTC (rev 74447)
+++ grass/branches/releasebranch_7_6/vector/v.what/what.c	2019-05-01 21:48:02 UTC (rev 74448)
@@ -73,7 +73,7 @@
 	G_fatal_error(_("Cannot fetch next record"));
 
     if (!more) {
-	G_warning(_("No database record"));
+	G_verbose_message(_("No database record"));
 	*form = G_store("No record selected.");
     }
     else {
@@ -91,6 +91,7 @@
 	    switch (output) {
 	    case OUTPUT_JSON:
 		formbuf = G_str_replace(db_get_string(&str), "\\", "\\\\");
+		formbuf = G_str_replace(formbuf, "\"", "\\\"");
 		sprintf(buf, "%s\"%s\": \"%s\"", col == 0 ? "" : ",\n",
 			colname, formbuf);
 		G_free(formbuf);



More information about the grass-commit mailing list