How can I debug Objects in Pebble.js?

139 views Asked by At

I'm fetching via ajax

ajax(
    {
        url: ...,
        type: 'json'
    },
    function(data) {
        // Success!
        console.log(data);
    },
    function(error) {
        // Failure!
    }
)

And I'm getting

[HANDY] pebble-app.js:?: [object Object]

If I know what attributes to look for, I can access them by data.key. But how about objects with unknown attributes or if I simply need deep debugging?

1

There are 1 answers

0
Matthew Lock On BEST ANSWER

Use JSON.stringify so you can see the values of your object as a JSON string in the app log:

console.log(JSON.stringify(data));

Lot's of Pebble.js examples use that to debug.