google-gson - A Java library to convert JSON to Java objects and vice-versa
2012-03-13 15:22
771 查看
http://code.google.com/p/google-gson/
Gson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to convert a JSON string to an equivalent Java object. Gson can work with arbitrary Java objects including pre-existing objects that you do not have source-code of.
There are a few open-source projects that can convert Java objects to JSON. However, most of them require that you place Java annotations in your classes; something that you can not do if you do not have access to the source-code. Most also do not fully support the use of Java Generics. Gson considers both of these as very important design goals.
Gson Goals
Provide simple toJson() and fromJson() methods to convert Java objects to JSON and vice-versa
Allow pre-existing unmodifiable objects to be converted to and from JSON
Extensive support of Java Generics
Allow custom representations for objects
Support arbitrarily complex objects (with deep inheritance hierarchies and extensive use of generic types)
Gson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to convert a JSON string to an equivalent Java object. Gson can work with arbitrary Java objects including pre-existing objects that you do not have source-code of.
There are a few open-source projects that can convert Java objects to JSON. However, most of them require that you place Java annotations in your classes; something that you can not do if you do not have access to the source-code. Most also do not fully support the use of Java Generics. Gson considers both of these as very important design goals.
Gson Goals
Provide simple toJson() and fromJson() methods to convert Java objects to JSON and vice-versa
Allow pre-existing unmodifiable objects to be converted to and from JSON
Extensive support of Java Generics
Allow custom representations for objects
Support arbitrarily complex objects (with deep inheritance hierarchies and extensive use of generic types)
相关文章推荐
- A Java library to convert JSON to Java objects and vice-versa GSON
- Gson is a Java library that can be used to convert Java Objects into their JSON representation.
- How to convert Java object to / from JSON (Gson)
- How can I convert a QString to char* and vice versa?
- How can I convert a QString to char* and vice versa ?
- How can I convert NSDictionary to NSData and vice versa?
- Convert CGPoint/CGRect/CGSize to NSValue and vice versa
- How to convert Java object to / from JSON (Gson)
- How can I convert NSDictionary to NSData and vice versa?
- How to read and write JSON files in Java(Gson)
- java bean convert to json string and json string convert to java bean
- Google-gson, 将JSON 转换为 Java 对象或者将Java对象转换成JSON 的Java库,可以在Android上使用
- 问题 java.lang.ClassCastException: com.google.gson.internal.LinkedTreeMap cannot be cast to
- Gson解析出现类似错误,com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_AR
- java.lang.ClassCastException: com.google.gson.internal.LinkedTreeMap cannot be cast to
- java.lang.ClassCastException: com.google.gson.internal.LinkedTreeMap cannot be cast to
- Unable to execute dex: Multiple dex files defineLcom/google/gson/JsonDeserializer;
- java.lang.NoClassDefFoundError: com.google.gson.stream.JsonReader 类似的在eclipse通过bulidpath导入包发生异常
- How To: Convert VirtualPC .vhd hard drives to VirtualBox .vdi hard drives (or vice-versa)
- google json API--json to java ojbect