{ This file is part of the Free Component Library JSON Data structures demo Copyright (c) 2007 by Michael Van Canneyt michael@freepascal.org See the file COPYING.FPC, included in this distribution, for details about the copyright. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. **********************************************************************} program simpledemo; {$mode objfpc}{$H+} uses Classes, SysUtils, fpjson; Procedure DumpJSONData(J : TJSonData; DOEOLN : Boolean = True); Var I : Integer; begin // JSONType property determines kind of value. Case J.jsontype of jtNull : Write('Null'); jtBoolean : If J.AsBoolean then Write('True') else Write('False'); jtNumber : {JSONNumber has extra NumberType property which determines kind of value (int/float).} Case TJSONNumber(J).NumberType of ntInteger : Write(J.AsInteger); ntFloat : Write(J.AsFloat:10:2); end; jtString : Write('"',J.AsString,'"'); jtArray : begin Write('[ '); For I:=0 to J.Count-1 do begin DumpJSONData(J.Items[I],False); If I