# Can anyone help me with this JSON API?

**URL:** <https://discourse.nodered.org/t/can-anyone-help-me-with-this-json-api/52226>\
**Category:** Developing Nodes\
**Created:** [14 October 2021 19:14 UTC](https://discourse.nodered.org/t/can-anyone-help-me-with-this-json-api/52226 "2021-10-14T19:14:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cinghialino](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cinghialino/32/49415_2.png) [@cinghialino](https://discourse.nodered.org/u/cinghialino)\
**Post date:** [14 October 2021 19:14 UTC](https://discourse.nodered.org/t/can-anyone-help-me-with-this-json-api/52226/1 "2021-10-14T19:14:42Z")

</div>

Hello Everyone,

I'm trying to extract data from a single station (unique by "station\_id") from this [JSON API](https://gbfs.citibikenyc.com/gbfs/en/station_status.json)

but because of syntax and my inexperience, I've failed so many attempts to create a node.  
I only was able to get a reply with all the stations, which is useless to me.

I'm attaching the node I did. Many thanks to anyone that will help me.

```auto
[{"id":"3efa2f6c5eba45bc","type":"ha-api","z":"f9b5be42.917d48","name":"API Citibike","server":"20f70dbb.a59b52","version":1,"debugenabled":false,"protocol":"http","method":"get","path":"https://gbfs.citibikenyc.com/gbfs/en/station_status.json","data":"{\"data/stations.station_id\":\"79\"}","dataType":"jsonata","responseType":"json","outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"results"}],"x":470,"y":280,"wires":[["cd1c0e4fa78ae79c"]]},{"id":"2fbaeade593a1e45","type":"inject","z":"f9b5be42.917d48","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":190,"y":280,"wires":[["3efa2f6c5eba45bc"]]},{"id":"cd1c0e4fa78ae79c","type":"debug","z":"f9b5be42.917d48","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":680,"y":260,"wires":[]},{"id":"20f70dbb.a59b52","type":"server","name":"Home Assistant","version":1,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

```

---

<div class="post-metadata">

**Author:** ![UnborN](https://avatars.discourse-cdn.com/v4/letter/u/4491bb/32.png) [@UnborN](https://discourse.nodered.org/u/UnborN)\
**Post date:** [14 October 2021 19:24 UTC](https://discourse.nodered.org/t/can-anyone-help-me-with-this-json-api/52226/2 "2021-10-14T19:24:07Z")

</div>

Here's an example with the http request node and javascript's [find method](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find)  
dont know if you find it useful in creating your node

```auto
[{"id":"2fbaeade593a1e45","type":"inject","z":"5847b7aa62131d37","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":300,"y":940,"wires":[["ec18945612b57b9e"]]},{"id":"cd1c0e4fa78ae79c","type":"debug","z":"5847b7aa62131d37","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":910,"y":940,"wires":[]},{"id":"ec18945612b57b9e","type":"http request","z":"5847b7aa62131d37","name":"","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://gbfs.citibikenyc.com/gbfs/en/station_status.json","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"x":490,"y":940,"wires":[["4e32b19bd744ec88"]]},{"id":"4e32b19bd744ec88","type":"function","z":"5847b7aa62131d37","name":"filter","func":"let stations = msg.payload.data.stations\nlet myStation = \"239\" // change for your station id\n\nmsg.payload = stations.find(el => el.station_id === myStation)\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":660,"y":940,"wires":[["cd1c0e4fa78ae79c"]]}]

```

---

<div class="post-metadata">

**Author:** ![cinghialino](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cinghialino/32/49415_2.png) [@cinghialino](https://discourse.nodered.org/u/cinghialino)\
**Post date:** [14 October 2021 19:25 UTC](https://discourse.nodered.org/t/can-anyone-help-me-with-this-json-api/52226/3 "2021-10-14T19:25:56Z")

</div>

Thank you, that works perfectly!

many many thanks, I've learned something new.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [28 October 2021 19:26 UTC](https://discourse.nodered.org/t/can-anyone-help-me-with-this-json-api/52226/4 "2021-10-28T19:26:12Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
