如何将类中的静态变量转换为json [英] how to convert static variables in class to json
问题描述
你好我有一个类只包含静态变量的常量variables.public class常量 我使用的是gson,但显然它忽略了静态变量。那么我该怎么做呢? 您可以使用此方法上的 Hi I have a class Constants that contain only static variables.public class Constants Is there a way to convert this class to JSON ? I was using gson, but apparently it ignores static variables. So how can I do it ? You can configure which field modifiers GSON ignores with this method on the 这篇关于如何将类中的静态变量转换为json的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
$ p $ public class常量
{
public static class A
{
public static class B
{
public static final int COLUMN = 0;
public static final String TYPE = ColumnType.INPUT;
$ / code $ / pre
有没有一种转换方法这个类到JSON?
谢谢。 GsonBuilder
class。public class Constant
{
public static class A
{
public static class B
{
public static final int COLUMN = 0;
public static final String TYPE = ColumnType.INPUT;
}
}
}
Thanks. GsonBuilder
class.