Sample code for 30+ languages & platforms
Pascal (Lazarus/Delphi)

Decode HTML Entity Encoded JSON

See more JSON Examples

Decodes an HTML entity encoded string to JSON.

Chilkat Pascal (Lazarus/Delphi) Downloads

Pascal (Lazarus/Delphi)
program ChilkatDemo;

// Demonstrates using the Chilkat Pascal wrapper via the C bridge DLL.
// Builds as a console application under Lazarus (FPC) or Delphi.

{$IFDEF FPC}
  {$MODE DELPHI}
{$ENDIF}
{$APPTYPE CONSOLE}

uses
  {$IFDEF UNIX}
  cthreads,
  {$ENDIF}
  SysUtils,
  CkDllLoader,
  Chilkat.StringBuilder;

// ---------------------------------------------------------------------------

procedure RunDemo;
var
  success: Boolean;
  sb: TStringBuilder;

begin
  success := False;

  sb := TStringBuilder.Create;

  success := sb.Append('{"xyz": "abc"}');

  sb.EntityDecode();

  //  This is a test comment;
  WriteLn(sb.GetAsString());

  //  Output is:

  //  {"xyz": "abc"}


  sb.Free;

end;

// ---------------------------------------------------------------------------

begin

  try
    RunDemo;
  except
    on E: Exception do
      WriteLn('Unhandled exception: ', E.ClassName, ': ', E.Message);
  end;

  WriteLn;
  {$IFDEF MSWINDOWS}
  WriteLn('Press Enter to exit...');
  ReadLn;
  {$ENDIF}
end.