A quick inspection of your code visually looks good.
Yes, you can use that JSON library file. It loads faster than the one you download from Douglas Crockford's github site.
Note that the processResponse I provided above is only an example. You will need to run the request from a web browser to be able to determine what devices are returned and the conditions you will need to create to assign your labels.