gsn icon indicating copy to clipboard operation
gsn copied to clipboard

GSN wrapper for JSON data?

Open kjorg50 opened this issue 11 years ago • 3 comments

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!

kjorg50 avatar Nov 17 '14 05:11 kjorg50

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.

ebiiii avatar Nov 17 '14 13:11 ebiiii

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

kjorg50 avatar Nov 18 '14 00:11 kjorg50

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

Thanks, Darko

dandrocec avatar Nov 07 '16 12:11 dandrocec