Martti Mäger Martti Mäger - 1 year ago 52
Javascript Question

Get value of a key which starts with a number

I ran into a problem using the Pipedrive API. I tried to get some data using the below but it returned an error:

$.each(, function(key,value) {

However this works:

$.each(, function(key,value) {

Why can't I get values of the keys that are complex strings generated by the Pipedrive system?

Answer Source

To retrieve what you require you would need to use bracket notation as the first character of the property identifier is an integer. Try this:

var value = {
    '0d1df598a5539ab5b6b410b339dc9218e0acb091': 'foo bar'