Java – how to convert static variables in a class to JSON
•
Java
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
二维码