LSIR / gsn

Global Sensor Networks
GNU General Public License v3.0
58 stars 43 forks source link

GSN wrapper for JSON data? #37

Open kjorg50 opened 9 years ago

kjorg50 commented 9 years ago

Let's say I wanted to use a third-party API as a data source, for example, Weather Underground. This API accepts GET requests and produces JSON in return (for the most part). Is there a way I could define a virtual sensor that can connect to an API and accept JSON data? I suppose this might be similar to the CSV Wrapper. Would the HTTP GET wrapper be appropriate for this?

Thanks!

ebiiii commented 9 years ago

The closest wrapper to your needs is the HTTP GET wrapper, but it was only written as an example getting data from a webcam. You could implement a new wrapper with almost the same structure but parsing the input stream with for example GSON and setting in the parameters of the wrapper the structure of the output (data fields and types, like in the Direct-Remote-Push wrapper ) You may end up with a pretty static mapping from the fields in Json, but if you succeed to make it generic enough we would be happy to merge your contribution to the master branch of GSN.

kjorg50 commented 9 years ago

Thank you for such a quick reply! I will have to investigate this further

dandrocec commented 7 years ago

Is the mentioned feature (GSN wrapper for JSON data) implemented in meantime?

Thanks, Darko