These forums have been archived and are now read-only.

The new forums are live and can be found at https://forums.eveonline.com/

EVE Technology Lab

 
  • Topic is locked indefinitely.
 

ESI Deserialize Wallet

Author
Kharana Vorton
Center for Advanced Studies
Gallente Federation
#1 - 2016-12-03 22:09:31 UTC
I cant find how to deserialize the wallet when there are 2 of them both with the same names...

Any Help?

[
{
"balance": 3225510,
"wallet_id": 1000
},
{
"balance": 0,
"wallet_id": 1200
}
]
Blacksmoke16
Imperial Academy
#2 - 2016-12-04 00:40:01 UTC  |  Edited by: Blacksmoke16
ATM there is only a wallet endpoint for characters. As such the only wallet_id used for characters is id 1000. Unless ccp adds in personal wallet divs i doubt the others will get used.

In regards to your question could you just search the array for the obj where wallet_id = 1000?
Kharana Vorton
Center for Advanced Studies
Gallente Federation
#3 - 2016-12-07 18:00:06 UTC
its an array just search it.... lol
Blacksmoke16
Imperial Academy
#4 - 2016-12-07 22:21:48 UTC
Yes what?

Javascript:
https://lodash.com/docs/4.17.2#find

Ruby:
https://ruby-doc.org/core-2.2.3/Enumerable.html#method-i-find

Prob are others, but idk what language you are using.
Kharana Vorton
Center for Advanced Studies
Gallente Federation
#5 - 2016-12-07 22:40:36 UTC
Ohh sorry, thank you, yea I was just making fun of myself. Apologies I see how that seemed rude.
Blacksmoke16
Imperial Academy
#6 - 2016-12-07 22:41:19 UTC
np, good luck on your project.
Kharana Vorton
Center for Advanced Studies
Gallente Federation
#7 - 2016-12-09 06:05:03 UTC
I have tried for 2 days, I am missing something, I have lodash as a src script, I can not for the life of me get this array to return just the balance of wallet:1000.

Any Help would be greatly appreciated.

I am using javascript.
Blacksmoke16
Imperial Academy
#8 - 2016-12-09 15:13:14 UTC
var data =  [
{
"balance": 3225510,
"wallet_id": 1000
},
{
"balance": 0,
"wallet_id": 1200
}
];

var balance = _.find(data, function(o) { return o.wallet_id == 1000; }); 

console.log(balance);
Kharana Vorton
Center for Advanced Studies
Gallente Federation
#9 - 2016-12-11 22:08:35 UTC
thank you for your response, I did find out that what I needed to do was much simplier, as the result is always returned in the same order I simplyneeded to call data[0].balance, data being the array, to get the number I needed.

Thank you again very much though, the search will do a world of good for my looking thru the skills response.

Cheers!