[GRASS-SVN] r74048 - grass/trunk/vector/v.what
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Jan 30 14:50:07 PST 2019
Author: mmetz
Date: 2019-01-30 14:50:06 -0800 (Wed, 30 Jan 2019)
New Revision: 74048
Modified:
grass/trunk/vector/v.what/what.c
Log:
v.what: fix JSON output format by escaping "
Modified: grass/trunk/vector/v.what/what.c
===================================================================
--- grass/trunk/vector/v.what/what.c 2019-01-30 11:02:35 UTC (rev 74047)
+++ grass/trunk/vector/v.what/what.c 2019-01-30 22:50:06 UTC (rev 74048)
@@ -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