[GRASS-dev] [GRASS GIS] #3133: v.what output is not valid JSON format

#3133: v.what output is not valid JSON format
-------------------------+-------------------------
Reporter: marisn | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.3.0
Component: wxGUI | Version: svn-trunk
Keywords: v.what | CPU: Unspecified
Platform: Unspecified |
-------------------------+-------------------------
It seems that wxGUI vector attribute query tool is parsing text attribute
values - "\" character is used as an escape character instead of its
literal value.
Thus \' will cause "invalid JSON" error, \b will render a backspace, \ \
(double backslash) will render as a single \ symbol.
{{{
v.db.select map=rm_me@user1
cat|title
1|\'foo,
2|ba'\'r
3|ba'
4|ba'\b'r
5|ba\\'r
}}}

{{{
File "/home/maris/soft/grass_trunk/dist.x86_64-pc-linux-
gnu/gui/wxpython/mapdisp/frame.py", line 963, in QueryMap
     distance=qdist, encoding=encoding)
   File "/home/maris/soft/grass_trunk/dist.x86_64-pc-linux-
gnu/etc/python/grass/script/vector.py", line 395, in vector_what
     raise ScriptError(_("v.what output is not valid JSON format:\n
{ret}").format(ret=ret))
ScriptError: v.what output is not valid JSON format:
  {"Coordinates": {"East": "18.484321", "North": "9.264808"},
"Maps":
[{"Map": "rm_me",
"Mapset": "user1",
"Type": "Point",
"Id": 1,
"Categories": [
{"Layer": 1, "Category": 1,
"Driver": "sqlite",
"Database":
"/home/maris/grass_data/nc_basic_spm_grass7/user1/sqlite/sqlite.db",
"Table": "rm_me",
"Key_column": "cat",
"Attributes": {"cat": "1",
"title": "\'foo,"}}]}]}
}}}

{{{

}}}

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3133&gt;
GRASS GIS <https://grass.osgeo.org>

#3133: v.what output is not valid JSON format
--------------------------+-------------------------
  Reporter: marisn | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.3.0
Component: wxGUI | Version: svn-trunk
Resolution: | Keywords: v.what
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------

Comment (by annakrat):

In [changeset:"69178" 69178]:
{{{
#!CommitTicketReference repository="" revision="69178"
v.what: escape backslash in attributes for valid JSON, see #3133
}}}

--
Ticket URL: </ticket/3133#comment:1>
GRASS GIS <https://grass.osgeo.org>

#3133: v.what output is not valid JSON format
--------------------------+-------------------------
  Reporter: marisn | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.4.0
Component: wxGUI | Version: svn-trunk
Resolution: | Keywords: v.what
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------

Comment (by annakrat):

In [changeset:"69442" 69442]:
{{{
#!CommitTicketReference repository="" revision="69442"
v.what: escape backslash in attributes for valid JSON, see #3133 (merge
from trunk, r69178)
}}}

--
Ticket URL: </ticket/3133#comment:3>
GRASS GIS <https://grass.osgeo.org>

#3133: v.what output is not valid JSON format
--------------------------+-------------------------
  Reporter: marisn | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.4.0
Component: wxGUI | Version: svn-trunk
Resolution: | Keywords: v.what
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------

Comment (by annakrat):

In [changeset:"69443" 69443]:
{{{
#!CommitTicketReference repository="" revision="69443"
v.what: escape backslash in attributes for valid JSON, see #3133 (merge
from trunk, r69178)
}}}

--
Ticket URL: </ticket/3133#comment:4>
GRASS GIS <https://grass.osgeo.org>

#3133: v.what output is not valid JSON format
--------------------------+-------------------------
  Reporter: marisn | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.0.5
Component: Vector | Version: svn-trunk
Resolution: fixed | Keywords: v.what
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------
Changes (by annakrat):

* status: new => closed
* resolution: => fixed
* component: wxGUI => Vector
* milestone: 7.4.0 => 7.0.5

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3133#comment:5&gt;
GRASS GIS <https://grass.osgeo.org>