num_bathrooms field is a string instead of a number in returned json data

20 views
Skip to first unread message

Kun Liu

unread,
Dec 10, 2013, 6:20:10 PM12/10/13
to roomor...@googlegroups.com
Hi,

In version 1.0 of the API, when using the get data method for a certain property, the value of num_bathrooms field is enclosed with a double quote like below, is this intentional?

It seems to be inconsistent with the other number fields such as num_single_beds, num_double_beds etc.

When implementing a sort filter it causes some trouble, we have to update the data before hand to convert that field into a number for MongoDB.

{
   
"result": {
       
"id": 51444,
       
"title": "NYC Room - Close To Central Park",
       
"type": "room",
       
"subtype": "private",
       
"url": "https://roomorama.com/short-term-rentals/new-york/upper-east-side/room/51444",
       
"num_bathrooms": "1",
       
"max_guests": 1,
       
"min_stay": 1,
       
"floor": "",
       
"num_single_beds": 1,
       
"price": 49,
       
"currency_code": "USD",
       
"currency_display": "US$",
...
}

Thanks!
Kyle

Donald Piret

unread,
Dec 10, 2013, 6:25:08 PM12/10/13
to roomor...@googlegroups.com
Hi Kyle,

Yes this is intentional as the number of bathrooms can be a non-integer string to indicate half-bathrooms. Eg. “0.5”, “1.5”.
We thought having this as a string would make more sense than as a floating point number.
If you believe having a number for this field would be a lot easier to deal with I can bring it up to the team for correction in the next version release of the API.

Donald Piret

--
You received this message because you are subscribed to the Google Groups "Roomorama API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to roomorama-ap...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages