We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
type TChildObject = class private FchildProp: string; public property childProp: string read FchildProp write FchildProp; end;
type TMainObject = class private FmainProp: string; Fchild: TChildObject; public property mainProp: string read FmainProp write FmainProp; property child: TChildObject read Fchild write FChild; <<<------------ end;
function TTestResource.Test: string; begin var LMain := TMainObject.Create; LMain.mainProp := 'mainProp';
var LJO := TJSONObject.Create; try LJO.FromObject( LMain );
ForceDirectories( 'c:\tteemmpp' ); TFile.WriteAllText( 'c:\tteemmpp\xxx.json', LJO.ToJSON );
finally LJO.Free; LMain.Free; end; end;
{"mainProp":"mainProp","child":null}
The "child" property appears with null value. I think that with SkipEmptyValues=true the property must not exist.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
testskip.zip
Model
type
TChildObject = class
private
FchildProp: string;
public
property childProp: string read FchildProp write FchildProp;
end;
type
TMainObject = class
private
FmainProp: string;
Fchild: TChildObject;
public
property mainProp: string read FmainProp write FmainProp;
property child: TChildObject read Fchild write FChild; <<<------------
end;
IMPLEMENTATION
function TTestResource.Test: string;
begin
var LMain := TMainObject.Create;
LMain.mainProp := 'mainProp';
var LJO := TJSONObject.Create;
try
LJO.FromObject( LMain );
finally
LJO.Free;
LMain.Free;
end;
end;
RESULT (xxx.json)
{"mainProp":"mainProp","child":null}
The "child" property appears with null value. I think that with SkipEmptyValues=true the property must not exist.
The text was updated successfully, but these errors were encountered: