#1 2020-09-28 08:01:28

Alek
Member
From: Russia
Registered: 2014-07-04
Posts: 44

Indent record

Hello everyone. I want to serialize some records to a file. These records are inside object. When I writing code, as sample:

recapparat:=GetParamApparatUstr;
AddString('ParamApparat:');
AddRecordJSON(recapparat,TypeInfo(TApparatDataUstr));
Add(',');
....

I got:
{
ParamApparat:{
    TrToka: [0,1,2,3,4,5,6,7],
    TrTkOtb: [3],
    TrNapr: [8,9,10,11,12,13,14],
    Vhody: [16,16,16],
    Rele: [16,16,16]
}
}

How I can get this(to indent all fields of records?):
{
    ParamApparat:{
        TrToka: [0,1,2,3,4,5,6,7],
        TrTkOtb: [3],
        TrNapr: [8,9,10,11,12,13,14],
        Vhody: [16,16,16],
        Rele: [16,16,16]
    }
}

Thank you.

Last edited by Alek (2020-09-28 08:14:11)

Offline

#2 2020-09-28 08:41:58

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: Indent record

I have published TTextWriter.HumanReadableLevel so that you may add 1 and decrease 1 to change the current indexation level.

Offline

#3 2020-09-28 08:58:29

Alek
Member
From: Russia
Registered: 2014-07-04
Posts: 44

Re: Indent record

Thank you. It works very well;

Last edited by Alek (2020-09-28 09:01:29)

Offline

Board footer

Powered by FluxBB