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
{{ message }}
This repository was archived by the owner on Apr 25, 2026. It is now read-only.
I'm writing an application that needs to be compatible with a legacy client whose code I can't change.
I have an issue where I have an object that has a nested array. The client expects the array to be serialized without a string key. It's just indexed starting with i:0.
E.g.
My class:
public class MyClass
{
// How to avoid the `objects` key prefix?
public List<Objects>? objects { get; set; }
[PhpProperty("some_string")]
public string? some_string{ get; set; }
[PhpProperty("some_string2")]
public string? some_string2{ get; set; }
[PhpProperty("some_string3")]
public string? some_string3{ get; set; }
[PhpProperty("some_string4")]
public string? some_string4{ get; set; }
}
another option I tried was just using an object but not a list:
// How to have this be an integer index?
public Objects? objects { get; set; }
The output I'm hoping to match would look like this:
// Notice the array index `0` is used without any string key
a:5:{i:0;a:2:
I'm writing an application that needs to be compatible with a legacy client whose code I can't change.
I have an issue where I have an object that has a nested array. The client expects the array to be serialized without a string key. It's just indexed starting with
i:0.E.g.
My class:
another option I tried was just using an object but not a list:
The output I'm hoping to match would look like this:
What I'm actually getting [List version]:
What I'm getting [without List version]:
Thanks in advance.