# Documentation of GetRooms has an error (example code)

**URL:** <https://discourse.lynckia.com/t/documentation-of-getrooms-has-an-error-example-code/190>\
**Category:** Uncategorized\
**Created:** [April 15, 2015, 8:18am UTC](https://discourse.lynckia.com/t/documentation-of-getrooms-has-an-error-example-code/190 "2015-04-15T08:18:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jordi\_Casadevall](https://avatars.discourse-cdn.com/v4/letter/j/e480ec/32.png) [@Jordi\_Casadevall](https://discourse.lynckia.com/u/Jordi_Casadevall)\
**Post date:** [April 15, 2015, 8:18am UTC](https://discourse.lynckia.com/t/documentation-of-getrooms-has-an-error-example-code/190/1 "2015-04-15T08:18:59Z")

</div>

Yesterday, starting to learn the API (Server) from your web (  
[http://lynckia.com/licode/server-api.html](http://lynckia.com/licode/server-api.html)), i have found that this code  
isn’t working:

1. N.API.getRooms(function(rooms) {
2. for(var i in rooms) {
3. console.log('Room ', i, ‘:’, rooms[i].name);
4. }
5. }, errorCallback);

As you can see, I think it needs a “JSON.parse(rooms)” to deserialise the  
array of rooms, and make the code works. At least, without the  
"JSON.parse", it hasn’t worked in my testing.

Bye bye!

---

<div class="post-metadata">

**Author:** ![Ignacio\_Aguado](https://avatars.discourse-cdn.com/v4/letter/i/35a633/32.png) [@Ignacio\_Aguado](https://discourse.lynckia.com/u/Ignacio_Aguado)\
**Post date:** [April 20, 2015, 11:36am UTC](https://discourse.lynckia.com/t/documentation-of-getrooms-has-an-error-example-code/190/2 "2015-04-20T11:36:51Z")

</div>

Hi Jordi,

Yes, you are absolutely right. It’s OK now, thank you very much!
