输入的有效Base-64字符串错误,我的JSON使用双引号而不是单引号

时间:2018-12-19 12:30:32

标签: json delphi firemonkey idhttp

我正在尝试发送JSON帖子,但我的JSON似乎与网站通常发送的帖子有所不同
这是我要发送的内容:

{"CodeNumberTextBox":"","txusername":"yC6IBEbznlRlKOKv8zrhiA","txpass":"pAQAyrr5u9/hK35iTIlt7Q=="}

这是您单击登录后网站发送的内容:

{ CodeNumberTextBox:'', txusername:'yC6IBEbznlRlKOKv8zrhiA', txpass:'pAQAyrr5u9/hK35iTIlt7Q==' }

这是我发送JSON时遇到的错误:
'The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters. '
我使用下面的代码创建我的JSON

  jsonRawRequest := TJSONObject.Create;
  jsonObject.AddPair('CodeNumberTextBox', '');
  jsonObject.AddPair('txusername', 'yC6IBEbznlRlKOKv8zrhiA');
  jsonObject.AddPair('txpass', 'pAQAyrr5u9/hK35iTIlt7Q==');
  jsonRequest := TStringStream.Create(jsonRawRequest.ToString(), TEncoding.UTF8);

  idHttp.Request.ContentType := 'application/json';
  idHttp.Request.Referer := 'SomeURL';
  idHttp.Post(URL, jsonRequest, ms)

0 个答案:

没有答案