Serializing compound object with flattened JSON objects.