OSMBrasil / zapto

Uma maneira fácil de colocar seus negócios no OSM.
https://zapto.openstreetmap.org.br
The Unlicense
3 stars 0 forks source link

Helper for update of JSON #11

Closed alexandre-mbm closed 10 years ago

alexandre-mbm commented 10 years ago

Option 1: jsonlint

Install:

$ sudo apt-get install python-demjson

Examples:

$ jsonlint -v categories.json-backup 
categories.json-backup: line terminator characters must be escaped inside string literals: u'\n"Advogado",\n"Ae...
$ jsonlint -v categories.json 
categories.json: ok

Option 2: json.tool Python module

Example:

alexandre$ cat categories.json-backup | python -m json.tool
Invalid control character at: line 3 column 13 (char 29)
alexandre-mbm commented 10 years ago

Solution in shell script = option 1 + option 2

Test:

$ ./gencat.sh
Invalid control character at: line 4 column 11 (char 41)
categories.json: line terminator characters must be escaped inside string literals: u'\n"Aeroporto",\n"A...
$ ./gencat.sh
Invalid control character at: line 4 column 11 (char 41)
categories.json: line terminator characters must be escaped inside string literals: u'\n"Aeroporto",\n"A...
$ ./gencat.sh
Expecting , delimiter: line 9 column 1 (char 124)
categories.json: values must be separated by a comma: u'"Albergue"'
$ ./gencat.sh
categories.json: ok
alexandre$ 
alexandre-mbm commented 10 years ago

@sabas, @osmlab, this may interest you.

Example:

$ ./gencat.sh
categories.json: ok
payment.json: ok
sabas commented 10 years ago

Cool! :)