简体   繁体   中英

Parse Get JSON Sub-Object Contents in Node.js

I'm trying to write a Parse query with the code

exports.getProfile = function(req, res) {
    var Profile = Parse.Object.extend("Profile");
    var query = new Parse.Query(Profile);
    query.equalTo("username", "philfishbein");
    query.find({
        success: function(object) {
            console.log(object);
        },
        error: function(error) {
            console.log("error!");
        }
    });
}

Which outputs among other things:

[ { _serverData: 
     { age: '17',
       email: 'phil@fishbe.in',
       facebook: 'philfishbein',
       fullname: 'Phil Fishbein',
       github: 'fishbein',
       languages: [Object],
       location: 'New Jersey',
       twitter: 'fishbein',
       username: 'philfishbein',
       years: '5' },
    ...} ]

However when I change the log statement to something like object._serverData , it returns undefined . What am I doing wrong?

The JSON is an array of dictionaries. In this case it has just one entry in the array. Try object[0]._serverData instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM