Hi, thanks for the reply. If I do something like this -
msg.send "#{json[0]}"
I get this in the chat
[object Object]
What am I missing?
On 6 February 2014 23:09, Stanley Stuart <[email protected]> wrote:
> Your json is returning an array, so to get to the first object in the
> array, you'd need to do json = json[0]
>
>
> On Thu, Feb 6, 2014 at 4:56 PM, sapg <[email protected]> wrote:
>
>>
>> Hello all,
>>
>> I'm trying to wrote a hubot script that will use the API at
>> http://www.macvendorlookup.com to give me information on a Vendor for a
>> MAC. My script is over at
>> https://github.com/sapg/hubot-scripts/blob/master/mac-lookup.coffee
>>
>> I'm not sure how to get what I want in the format I want in the chat.
>> The most frustrating thing is that it appears exactly the way I want it on
>> the console.
>>
>> In the console -
>>
>> Hubot> hubot mac 00:1d:e0:64:82:75
>> Hubot> [ 'hubot mac 00:1d:e0:64:82:75',
>> '00:1d:e0:64:82:75',
>> index: 0,
>> input: 'hubot mac 00:1d:e0:64:82:75' ]
>> [Thu Feb 06 2014 22:44:41 GMT+0000 (GMT)] WARNING @http() is going to be
>> deprecated in 3.0.0 use @robot.http()
>> [ { starthex: '001DE0000000',
>> endhex: '001DE0FFFFFF',
>> startdec: '128312147968',
>> enddec: '128328925183',
>> company: 'Intel Corporate',
>> department: 'Lot 8, Jalan Hi-Tech 2/3',
>> address1: 'Kulim Hi-Tech Park',
>> address2: 'Kulim Kedah 09000',
>> country: 'MALAYSIA',
>> db: 'oui24' } ]
>>
>> In the chat -
>>
>> [{"starthex":"001DE0000000","endhex":"001DE0FFFFFF","startdec":"128312147968","enddec":"128328925183","company":"Intel
>> Corporate","department":"Lot 8, Jalan Hi-Tech 2\/3","address1":"Kulim
>> Hi-Tech Park","address2":"Kulim Kedah
>> 09000","country":"MALAYSIA","db":"oui24"}]
>> Hubot> company: undefined
>> department: undefined
>> address1: undefined
>> address2: undefined
>> country: undefined
>>
>> Hubot> Er, couldn't find the vendor for that MAC
>>
>> I'm confused, can anyone help?
>>
>> Thanks.
>>
>> --
>> --
>> Job Board: http://jobs.nodejs.org/
>> Posting guidelines:
>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>> You received this message because you are subscribed to the Google
>> Groups "nodejs" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "nodejs" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>>
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
> --
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "nodejs" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/nodejs/E4IU3b4l5_s/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.