SerializationUtils not present in fabric 6.*

20 Views Asked by At

I am using the following lines using fabric client

import io.fabric8.kubernetes.client.internal.SerializationUtils;
String actualYaml = SerializationUtils.dumpAsYaml(job);

This was working in fabric version 5.*, but when I moved to later version like io.fabric8:kubernetes-client:6.6.2, this SerializationUtils is not found. I believe this is deprecated.

Is there any alternate for this? How do I achieve the same functionality?

Thanks in advance

1

There are 1 best solutions below

0
On

You can use Serialization

In order to serialize as JSON string use:

String actualJson = Serialization.asJson(job);

In order to serialize as YAML string use:

String actualYaml = Serialization.asYaml(job);