First, I have a very simple java bean which can be easily serialized to json:

```
class Node {
    private String text;
    // getter and setter
}

Node node = new Node();
node.setText("Hello");

String json = new Gson().toJson(node);
// json is { text: "Hello" }

```

Then in order to make such beans have some dynamic values, so I create a "WithData" base class:

```
Class WithData {
    private Map<String, Object> map = new HashMap<String, Object>();
    public void setData(String key, Object value) { map.put(key, value); }
    public Object getData(String key) = { return map.get(key); }
}

class Node extends WithData {
    private String text;
    // getter and setter
}

```

Now I can set more data to a node:

```
Node node = new Node();
node.setText("Hello");
node.setData("to", "The world");

```

But Gson will ignore the "to", the result is still `{ text: "Hello" }`. I expect it to be: `{ text: "Hello", to: "The world" }`

Is there any way to write a serializer for type `WithData`, that all classes extend it will not only generate its own properties to json, but also the data in the `map`?

I tried to implement a custom serializer, but failed, because I don't know how to let Gson serialize the properties first, then the data in map.