You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm looking to have an object that I'm using as a data model which will eventually be serialized. But I want to mark some fields as ignored, but not PhpIgnore (which skips it unconditionally) but something along the lines of "Ignore, but only if it's null".
For example:
public class MyClass {
[PhpProperty("Foo")]
public string Foo {get;set;};
// ... Other stuff
}
If Foo is null, it will serialize along the lines of: s:3:"Foo";N;
I would like this output to be skipped entirely if it is null.
Maybe something like
public class MyClass {
[PhpProperty("Foo")]
[PhpIgnoreNull] // Or similar
public string Foo {get;set;};
// ... Other stuff
}