JSON to CSV file conversion -
i have json file
{ "name": "re2", "count": 1806, "frequency": "realtime", "version": 5, "newdata": true, "lastrunstatus": "success", "lastsuccess": "fri may 30 2014 06:02:41 gmt+0000 (utc)", "results": { "collection1": [ { "title": { "href": "http://www.realestate.com.au/project-spec+property+%e2%80%93+helio+apartments-vic-north+melbourne-600004887", "text": "93 flemington road, north melbourne, vic 3051" }, "image": { "href": "http://www.realestate.com.au/project-spec+property+%e2%80%93+helio+apartments-vic-north+melbourne-600004887", "alt": "93 flemington road, north melbourne, vic 3051", "src": "http://i2.au.reastatic.net/345x200/3a7e58fe3aefa7fd373c1b9c9879d648257dc0e7c8d35c6b7a19d261bffeff28/main.jpg" }, "price": "$700,000 - $770,000", "title2": { "href": "http://www.realestate.com.au/project-spec+property+%e2%80%93+helio+apartments-vic-north+melbourne-600004887", "text": "93 flemington road, north melbourne, vic 3051" } }, { "title": { "href": "http://www.realestate.com.au/project-redmond+park-vic-carlton+north-600002807", "text": "300 pigdon street, carlton north, vic 3054" }, "image": { "href": "http://www.realestate.com.au/project-redmond+park-vic-carlton+north-600002807", "alt": "300 pigdon street, carlton north, vic 3054", "src": "http://i2.au.reastatic.net/345x200/c22712b2c40db6e8017ebc6f677c9835991e3e1ab9431cfe28d0ab8ea0af43e3/main.jpg" }, "price": "$830,000 - $880,000", "title2": { "href": "http://www.realestate.com.au/project-redmond+park-vic-carlton+north-600002807", "text": "300 pigdon street, carlton north, vic 3054" } }, { "title": { "href": "http://www.realestate.com.au/property-house-vic-kensington-116973739", "text": "60 wolseley parade, kensington, vic 3031" }, "image": { "href": "http://www.realestate.com.au/property-house-vic-kensington-116973739", "alt": "60 wolseley parade, kensington, vic 3031", "src": "http://i4.au.reastatic.net/355x265/e026805577c810c6df722c171a00786f4510cb959390375d589e2d1d90ef2461/main.jpg" }, "price": "sold $1,360,000", "title2": { "href": "http://www.realestate.com.au/property-house-vic-kensington-116973739", "text": "60 wolseley parade, kensington, vic 3031" } },
i tried numerous online json csv converters file, , never converts properly.
i csv file title, href, text, image, href, alt, src, price
due complexity of file, i'm having no luck tutorials online.
generally it's not possible automatically convert json csv, since 1 object graph, , other table. trying convert cube circle.
to further complicate matter json doesn't seem homogenous. first entry doesn't have title2 instance. in order solve problem break down following steps:
- convert json proper objectgraph.
- collapse object graph flat list. mapping fields necessary.
- write out list csv.
it not obvious example json whether practical read memory @ once, or whether need break down, converting 1 item @ time. doubt find online tool you, since json seems incoherent , needs specific.
Comments
Post a Comment