drugo76 / json2csv

Convert JSON file to CSV
14 stars 17 forks source link

Problem during conversion #1

Open maggix opened 10 years ago

maggix commented 10 years ago

Hello, I am trying to convert a .json file which breaks the script.

Traceback (most recent call last):
File "json2csv.py", line 74, in <module>
main()
File "json2csv.py", line 61, in main
value = item.get(key, '')
AttributeError: 'unicode' object has no attribute 'get'

JSON file is nothing special.

[
{
"type": "node",
"id": 259778678,
"lat": 45.4964729,
"lon": 9.2481738,
"tags": {
"amenity": "waste_basket"
}
},
{
"type": "node",
"id": 611917417,
"lat": 45.5718222,
"lon": 9.2082012,
"tags": {
"amenity": "waste_basket",
"source": "survey"
}
]

Has it something to do with the "nested" attributes?

drugo76 commented 10 years ago

Yes. The script doesn't support nasted attributes (yet...).

ravikuc commented 6 years ago

Could you please suggest a script for nested JSON file?