0

How can I get the value of a object in coffeescript: {text="mytext", @name="Jon"}

object.text works great but can`t get object.@name and is a 3party api json object (ebay api for example use a attribute name with @ for currency_Id), what can I do?

Nitsan Baleli
  • 5,273
  • 3
  • 28
  • 51
Josebyte
  • 31
  • 9

2 Answers2

1

You should be able to acceess properties like this:

obj['@name']
Niko
  • 26,166
  • 8
  • 90
  • 108
1

You can use what's called 'Bracket notation'

object['@name']

You should use this method when: (taken from this answer)

The property name contains characters not permitted in identifiers, e.g. starts with a digit†, or contains a space or dash (-), e.g. obj["my property"].

You can read up on the topic here

Community
  • 1
  • 1
Nitsan Baleli
  • 5,273
  • 3
  • 28
  • 51