[Lazarus] Adding items in a json object and then save to file

silvioprog silvioprog at gmail.com
Wed Feb 8 00:49:34 CET 2012


2012/2/7  <michael.vancanneyt at wisa.be>:
> On Tue, 7 Feb 2012, silvioprog wrote:
>> Hellow guys, good afternoon. :)
>>
>> I'm tried to add items in a json object, and I tryied to save it in a
>> file using stream. My doubt is: do I need to do everything manually?
>> Or has json a native feature to save it in file? I really could not
>> find it.
>
> You must do it manually.
>
> It's really simple.
>
> Var
>  S : TJSONStringType;
>
> begin
>
> With TFileStream.Create(MyFileName,fmCreate)
>  try
>    S:=MyObject.AsJSON;
>    WriteBuffer(S[1],Length(S));
>  finally
>    Free;
>  end;
>
> But maybe a method to do this would not be bad.
>
> Michael.

His was exactly answer I wanted. Thank you guy! :)

-- 
Silvio Clécio
====================================
Site - <silvioprog.com.br>
LazSolutions - <code.google.com/p/lazsolutions>
====================================




More information about the Lazarus mailing list