ahausladen / JsonDataObjects

JSON parser for Delphi 2009 and newer
MIT License
414 stars 160 forks source link

Parse this JSON string error #40

Closed laoqiuqiu closed 6 years ago

laoqiuqiu commented 6 years ago
[{
    "2": "[{\"xx\":11,\"a\":1,\"b\":\"000000000\",\"c\":1,\"d\":\"2018-04-23 13:36:18\",\"e\":6,\"f\":\"\",\"g\":12,\"h\":\"00000000\",\"i\":1472,\"j\":\"\",\"k\":\"/8a44f9442e64.jpg\",\"l\":\"553031\",\"m\":\"1\",\"n\":0,\"o\":\"100002000000000\",\"p\":\"86,85,84,33,32,31,\",\"q\":\"fbeeeeee48df429399118\"}]"
}]
ahausladen commented 6 years ago

JsonDataObjects can parse this without a problem. Did you use the latest version?

laoqiuqiu commented 6 years ago

Is the string too long truncated?

laoqiuqiu commented 6 years ago
  st := TStringStream.Create('', TEncoding.UTF8);
  hc := THTTPClient.Create;
  hc.Get(a+b, st);
  mmoLog.Clear;
  mmoLog.Lines.Append(st.DataString);
  JO := TJsonObject.Create;
  try
    JO.LoadFromStream(st, TEncoding.UTF8);
    mmoLog.Lines.Append('=======================');
    mmolog.Lines.Append(JO.ToJSON);
    mmoLog.Lines.Append('=======================');
  finally
    JO.Free;
    hc.Free;
    st.Free;
  end;

I was using tstringstream, and the same mistake occurred. 000

laoqiuqiu commented 6 years ago

My mistake. I was wrong to use Tjsonobject to parse Tjsonarray.