No, It is Immpossible. To see why, take a look at the Go spec. So that it produces two different results for empty vs. nil, any serialization method would have to determine the difference between the two. However, according to the Go specification,
Two types of array are identical if they have the same element types and the same array length.
Since none of them contain any elements and have the same type of element, the only difference may be in length, but it also states that
The length of the zero fragment, card or channel is 0
Thus, by comparison, it would be impossible to say. Of course, there are methods other than comparisons, so to really put a nail in the coffin, here is the part that shows that they have the same basic idea. The specification also ensures that
The type of the structure or array is 0 if it does not contain fields (or elements, respectively) whose size is greater than zero.
therefore, the actual distributed structure of a zero-length array must be zero. If it is zero, it cannot store information about whether it is empty or nil , therefore the object itself also cannot know. In short, there is no difference between a nil array and a zero-length array.
The "noticeable initial difference between an empty array and a pointer to zero" is not lost during serialization / deserialization, it is lost from the moment the initial assignment is completed.