-
-
Notifications
You must be signed in to change notification settings - Fork 365
Description
JSON
JSON output of v.info with -c (print columns) is now a JSON object (dictionary) with a single key columns
and the list of columns is nested under that. While this is a flexible way of structuring the JSON, the user/caller here already specified quite precisely what they want, namely a list of columns, so giving a list is the expected behavior.
My guess is that possible changes will more likely be resolved by other flags or a separate tool.
Current
grass --tmp-mapset ~/grassdata/nc_spm_08_grass7/ --exec v.info bridges -c format=json
{
"columns": [
{
"name": "cat",
"sql_type": "INTEGER",
"is_number": true
},
{
"name": "CO_NAME",
"sql_type": "CHARACTER",
"is_number": false
}
]
}
Proposed
[
{
"name": "cat",
"sql_type": "INTEGER",
"is_number": true
},
{
"name": "CO_NAME",
"sql_type": "CHARACTER",
"is_number": false
}
]
CSV and shell
v.info with -c (print columns) and format=shell gives what is basically a CSV output. I suggests to add format=csv to v.info which would be now valid only with -c, while format=shell would not be valid with -c.
CSV should be the standard CSV, so comma as a separator and we also typically include header. This unfortunately means that for backwards compatibility, we need also an output without header and with pipe. This should be the same as for v.db.connect -c in #6077.
Additional context
- v.db.connect: Add JSON support #6077 (comment) ...implying that v.info -c format=shell is now wrongly labeled as shell, not CSV and needs the same header+compatibility update...
- v.category: return json array for layers option #6243 Makes the output of v.category option=layers into a list (prints list layers).
- v.db.connect: Add JSON support #6077 Adds JSON output to v.db.connect which includes output of columns with -c.
- db.columns: Output column metadata, not just names #6072 Suggests more advanced options to db.columns (which only gives a list of names now).
Metadata
Metadata
Assignees
Labels
Type
Projects
Status