Java – how to convert static variables in a class to JSON

Hello, I have a class constant that only contains static variables Public class constant

public class Constant
{
    public static class A
    {
        public static class B
        {
            public static final int  COLUMN = 0;
            public static final String  TYPE =  ColumnType.INPUT;
        }
    }
}

Is there any way to convert this class to JSON?

I'm using gson, but it obviously ignores static variables What should I do? thank you.

Solution

You can configure gson ignored field modifiers on the gsonbuilder class

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>