0

Here is my invalid JSON Body Error on Apiary.io? What went wrong?

My Request is like that:

var body = {
  //JSON stuff..
};

$.ajax({
  url : 'URL',
  type : 'POST',
  data : body,
  async: false,
  dataType : 'json',
  success : function (data) {
    body['sessionid'] = data['sessionid'];
    SetSessionID(data['sessionid']);
    console.log(data);
  }   
});  
  • There are encoded characters at the end of the JSON string, causing it to fail likely. `%3A32%3A56`. They translate into `:32:56` – Mouser Mar 08 '15 at 12:47
  • Besides `X&appversion` isn't working because it misses `"` around the value. – Mouser Mar 08 '15 at 12:54
  • my `var body` is like this: `var body = { 'trackingID': trackingID, 'platform': platform, 'appversion': platformversion, 'countryCode': countryCode, 'startDate': timestamp };` – JohnWalker891212 Mar 08 '15 at 13:00

1 Answers1

0

It looks like your JSON request is invalid and is urlencoded instead of JSON-encoded.

If that wouldn't help, it would help to post the actual data that went over the wire (in case of bug on Apiary side), and the relevant blueprint snippet for the given endpoint.

Almad
  • 5,753
  • 7
  • 35
  • 53