Closed StefanBrand closed 7 years ago
Uff, that's a tough one... Let me some time to understand it
Where did you get the initial JSON? Did your T-Mobile contact give it to you as is and then you adapted it to our API?
We can make a conversor (and cleaner) with node.js
, to get the data we want and discard the rest.
/* node.js supports ECMAScript 2015 syntax */
const fs = require('fs');
const rawData = require(`tMobileShops.raw.json`);
const /* let */ netData = {};
netData['shops'] = rawData['shops'].map(functionToClearAndAdapt);
fs.writeFile('tMobileShops.json', JSON.stringify(netData, null, 2));
About our API flaw, that's true. We need to review the openingHours
part... :/
Where did you get the initial JSON? Did your T-Mobile contact give it to you as is and then you adapted it to our API?
Exactly. I needed a lot of find-and-replace operations in atom.io (and this great regex tutorial) to modify the file. I couldn't find a way to automize it and a Windows batch file wasn't really an option.
Where does the |node.js| script run then? In the browser at every startup of the map?
Am 30.09.2016 um 01:17 schrieb Roberto M.F.:
Where did you get the initial JSON? Did your T-Mobile contact give it to you as is and then you adapted it to our API? We can make a conversor (and cleaner) with |node.js|, to get the data we want and discard the rest.
/* node.js supports ECMAScript 2015 syntax / const fs = require('fs'); const rawData = require(
tMobileShops.raw.json
); const / let */ netData = rawData.shops.map(functionToClearAndAdapt()); fs.writeFile('tMobileShops.json', netData);About our API flaw, that's true. We need to review the |openingHours| part... :/
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/WeAreFairphone/fprsmap/pull/29#issuecomment-250619122, or mute the thread https://github.com/notifications/unsubscribe-auth/AIiMgQfM86c75LjQ075LrwjlB-a12Z8Kks5qvEclgaJpZM4KKcXZ.
No. node.js
is a runtime outside of the browser to run JavaScript code. Furthermore, it provides in-out functions for reading and writing files (and much more, I'm simplifying here).
The idea is to run a node script locally (everytime we get an update) to generate the cleaned JSON to push to the repo. Automatize your manual regexes writting plain JavaScript, ;)
I'll create an issue in the other repo. See the following reference.
Oh my, I think I messed something up... Ö I rebased my local copy of the fork because I wanted to do some minor improvements on the README and now ended up with some older commits being part of this PR (and the README-commit 45cc89c also being part of it)... Help!
I've opened a new and clean PR for this matter. I'll close this, let's discuss the issue there: #32
See the comment on 5821d19 for the troubles I ran into...