Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong JSON output #65

Closed
benov84 opened this issue Jul 11, 2018 · 7 comments
Closed

Wrong JSON output #65

benov84 opened this issue Jul 11, 2018 · 7 comments

Comments

@benov84
Copy link

benov84 commented Jul 11, 2018

t {
_firstBoxerWeight: '',
_outcome: '',
_outcomeByWayOf: '',
_idName: 'Deontay Wilder',
_alias: 'The Bronze Bomber\n',
_record: '40 0 0\n',
_last6: '

\n
',
_division: ' heavyweight\n',
_career: ' \n \n2008-2018\n',
_location: '
Tuscaloosa, Alabama, USA' }

@benov84
Copy link
Author

benov84 commented Jul 11, 2018

the returning json contains html tags. how can i retrieve the correct json result? thank you

@mikedidomizio
Copy link
Member

So those are private variables, there should be getters that should be used. Depending on the method you are using, the documentation might help out - https://boxing.github.io/boxrec/classes/boxrec.html

There are examples of each method being used in the E2E test file located here - https://github.com/boxing/boxrec/blob/master/src/boxrec.class.spec.e2e.ts

If the above doesn't help, let me know what method you're using and what parameters.

@benov84
Copy link
Author

benov84 commented Jul 11, 2018

Hi, thank you for your fast reply.

This is my code (i've copied it from your examples):

app.get('/byId', function (req, res) {
    boxrec.login("user", "pass")
        .then(() => {
            boxrec.getPersonById(468841)
                .then(boxer => {
                    console.log(boxer);
                    res.end(boxer.name);
                });
        })
        .catch(error => {res.end("error logging")});  
})

Here boxer.name is OK, also boxer.record.win and so on...
But I want to get JSON with all the data for the boxer.
Thank you!

@benov84
Copy link
Author

benov84 commented Jul 11, 2018

{ id: 352, name: 'Floyd Mayweather Jr', alias: 'Money / Pretty Boy', record: { draw: 0, loss: 0, win: 50 }, last6: ['win', 'win', 'win', 'win', 'win', 'win'], division: 'welterweight', career: [1996, 2017], residence: { id: 20388, town: 'Las Vegas', region: 'NV', country: 'US' } } });

This is output from your example, but I can't get this result :)

@mikedidomizio
Copy link
Member

Your code above looks correct. In the first few versions there was a way to output all the data. I left the examples to show what data can be retrieved but currently there is not a way to output all the data like what you have. I haven't decided if it should be added back in. It's nice to have to show what all data there is, but I removed it because to use the data you still have to access it the same way as a getter.

@benov84
Copy link
Author

benov84 commented Jul 11, 2018

OK, I understand, it was my misunderstanding. Thank you very much! You've done great work! Keep it going. If I have time I would like to help with your project!

@mikedidomizio
Copy link
Member

No problem. Thanks for the compliments. Any help is appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants