Access option of object without being with dot

Asked

Viewed 58 times

2

I have an object json in javascript and need to access it,was currently accessing your options so:

registro.man_ins_prod_05

Entertaining on the hightchart in the part of adding values(date) on the chart, dots as comma. Functional example:

data: [5.2, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]

And if I put:

data: [registro.man_ins_prod_05, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]

It doesn’t work. Is there any way to trigger the option other than by dot?

  • I know the problem is solved, but the question is confused. Use registro.man_ins_prod_05 is identical to use registro['man_ins_prod_05']. The numbers in data you cannot access as keys because they are values, that is an array and not an object.

1 answer

3


You can access it as follows: registro["man_ins_prod_05"].

  • Thank you, it worked

  • In this case, I could accept the answer?

  • I think anyone with a low reputation can’t mark an answer as valid

  • do not consider 157 a low score ;D

  • 2

    I hadn’t scheduled it because you have minimal time to accept the answer

  • 1

    Tobymosque, worth a look here: http://meta.pt.stackoverflow.com/questions/1425/devemos-askfor a reply

  • 1

    @bfavaretto, my fault, is noted.

Show 2 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.