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 found issue 321 that mentions this behavior.
I conclude with the same thing, the problem is due to the indexes of the array.
The problem is that in my case the result comes from a Doctrine query and sometimes contains null values.
2 possible but not viable solutions in my opinion :
The first one is to add setSerializeNull(true), but this forces you to check in post traitement if the foreach that the value is not null.
The second is to browse the array before serialization to delete the null values and reorder the array, but it's not very optimal in terms of performance.
Would it not be possible to plan a correction/evolution to have an array rather than an object in this case?
If not, do you have another solution to offer me?
The text was updated successfully, but these errors were encountered:
Hello,
I have a problem of serialization. An array with non-consecutive keys is serialized as an object.
Examples of arrays :
The Serialization results are :
$a1 :
$a2 :
$a3 :
I found issue 321 that mentions this behavior.
I conclude with the same thing, the problem is due to the indexes of the array.
The problem is that in my case the result comes from a Doctrine query and sometimes contains null values.
2 possible but not viable solutions in my opinion :
The first one is to add setSerializeNull(true), but this forces you to check in post traitement if the foreach that the value is not null.
The second is to browse the array before serialization to delete the null values and reorder the array, but it's not very optimal in terms of performance.
Would it not be possible to plan a correction/evolution to have an array rather than an object in this case?
If not, do you have another solution to offer me?
The text was updated successfully, but these errors were encountered: