Графический интерфейс в aria2c RPC http://blindage.org/?p=5385
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

json.pas 777B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. unit json;
  2. interface
  3. uses
  4. SysUtils, fpjson,jsonparser;
  5. type
  6. TJSON = class(TJSONObject)
  7. public
  8. function ifExistKey(aKey: string): Boolean;
  9. function Parse(aString: string): Boolean;
  10. end;
  11. implementation
  12. function TJSON.ifExistKey(aKey: string): Boolean;
  13. begin
  14. result:=(Find(aKey)<>nil);
  15. end;
  16. function TJSON.Parse(aString: string): Boolean;
  17. var
  18. D : TJSONData;
  19. P : TJSONParser;
  20. jodata: TJSONData;
  21. joname: String;
  22. begin
  23. result:=false;
  24. P:=TJSONParser.Create(aString);
  25. D:=P.Parse;
  26. FreeAndNil(P);
  27. Clear;
  28. try
  29. while D.Count>0 do begin
  30. joname:=TJSONObject(D).Names[0];
  31. jodata:=TJSONObject(D).Extract(0);
  32. Add(joname,jodata);
  33. end;
  34. except
  35. FreeAndNil(D);
  36. exit;
  37. end;
  38. FreeAndNil(D);
  39. result:=true;
  40. end;
  41. end.