Jump to content
McKay Development

Recommended Posts

Posted

Hi. I was able to send trade offers just fine a while ago, I keep getting errors that this json is malformed. The only malformed parts I find are quotes and commas. What is wrong with this?

TradeOffer {
  partner: SteamID { universe: 1, type: 1, instance: 1, accountid: 306671577 },
  id: null,
  message: 'Trade Offer WITH Trade Bot',
  state: 1,
  itemsToGive: [ { assetid: '7806227681', appid: 730, contextid: '2', amount: 1 } ],
  itemsToReceive: [ { assetid: '2624718494', appid: 753, contextid: '6', amount: 1 } ],
  isOurOffer: true,
  created: null,
  updated: null,
  expires: null,
  tradeID: null,
  fromRealTimeTrade: false,
  confirmationMethod: null,
  escrowEnds: null,
  rawJson: '' }
Posted

What exactly is the error message you're getting, and where?

 

Also, please show the code that is generating and sending this offer.

function sendTradeOffer(tradeUrl, theirItems, myItems, message, callback){
    var offer = manager.createOffer(tradeUrl);
    
    if(theirItems != null){
        offer.addTheirItems(theirItems);
    }
    
    if(myItems != null){
        offer.addMyItems(myItems);
    }
    
    offer.setMessage(message);

    offer.send(function(err, status) {
        if (err) {
            callback(true, "Trade " + err);
        } else {
            callback(false, status);
        }
    });
    
    console.log(offer);
}

The error is "Trade Error: Malformed JSON response" I added trade to the string.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...