- 浏览: 1155420 次
- 性别:
- 来自: 北京
-
文章分类
- 全部博客 (411)
- Java Foundation (41)
- AI/机器学习/数据挖掘/模式识别/自然语言处理/信息检索 (2)
- 云计算/NoSQL/数据分析 (11)
- Linux (13)
- Open Source (12)
- J2EE (52)
- Data Structures (4)
- other (10)
- Dev Error (41)
- Ajax/JS/JSP/HTML5 (47)
- Oracle (68)
- FLEX (19)
- Tools (19)
- 设计模式 (4)
- Database (12)
- SQL Server (9)
- 例子程序 (4)
- mysql (2)
- Web Services (4)
- 面试 (8)
- 嵌入式/移动开发 (18)
- 软件工程/UML (15)
- C/C++ (7)
- 架构Architecture/分布式Distributed (1)
最新评论
-
a535114641:
LZ你好, 用了这个方法后子页面里的JS方法就全不能用了呀
页面局部刷新的两种方式:form+iframe 和 ajax -
di1984HIT:
学习了,真不错,做个记号啊
Machine Learning -
赵师傅临死前:
我一台老机器,myeclipse9 + FB3.5 可以正常使 ...
myeclipse 10 安装 flash builder 4.6 -
Wu_Jiang:
触发时间在将来的某个时间 但是第一次触发的时间超出了失效时间, ...
Based on configured schedule, the given trigger will never fire. -
cylove007:
找了好久,顶你
Editable Select 可编辑select
前端JSON:
JavaScript中的JSON
http://www.dreamdu.com/blog/2008/10/19/json_in_javascript/
用 javascript 处理 JSON
http://jelly.iteye.com/blog/138707
后台Java JSON:
java json处理框架,目前比较好的(性能等考量)两个是jackson和gson。比较:
http://stackoverflow.com/questions/2378402/jackson-vs-gson在json-tools、jackson、gson等中,jackson的性能无疑是最好的,着重抓住它的API就行了。
JACKSON:
1 jackson Serialization:
http://stackoverflow.com/questions/5430524/serialization-of-key-value-pairs-in-jackson
2 Using jackson deserialize a jsonString to java nested object:
http://stackoverflow.com/questions/8921089/jackson-converting-json-property-to-nested-object-with-dot-notation
3 jsonString中的key,在对应的java entity中使用 @JsonProperty 注解 做对应。
4 对 non-static inner class,jackson 可以将其 serializable 序列化,但不可以 deserializable 反序列化一个 json 字符串给该 non-static inner class,详见:
http://jira.codehaus.org/browse/JACKSON-594
http://www.cowtowncoder.com/blog/archives/2010/08/entry_411.html
http://stackoverflow.com/questions/7144912/why-is-a-serializable-inner-class-not-serializable
5 @JsonCreator 。。。。。。。
老版本的jackson只能通过默认的无参构造方法
新的支持通过 @JsonCreator 来用有参构造方法来做反序列化(当同时没有无参构造方法被定义时尤其有用),并且可以基于其对 enum 做反序列化:
。。。。。。。。
http://wiki.fasterxml.com/JacksonFeatureCreators
http://stackoverflow.com/questions/11838039/jackson-3rd-party-class-with-no-default-constructor
http://stackoverflow.com/questions/9300191/how-to-annotate-enum-fields-for-deserialization-using-jackson-json?rq=1
http://stackoverflow.com/questions/8790389/jackson-deserialize-one-base-enums
JavaScript中的JSON
http://www.dreamdu.com/blog/2008/10/19/json_in_javascript/
用 javascript 处理 JSON
http://jelly.iteye.com/blog/138707
后台Java JSON:
java json处理框架,目前比较好的(性能等考量)两个是jackson和gson。比较:
http://stackoverflow.com/questions/2378402/jackson-vs-gson在json-tools、jackson、gson等中,jackson的性能无疑是最好的,着重抓住它的API就行了。
JACKSON:
1 jackson Serialization:
http://stackoverflow.com/questions/5430524/serialization-of-key-value-pairs-in-jackson
2 Using jackson deserialize a jsonString to java nested object:
http://stackoverflow.com/questions/8921089/jackson-converting-json-property-to-nested-object-with-dot-notation
3 jsonString中的key,在对应的java entity中使用 @JsonProperty 注解 做对应。
4 对 non-static inner class,jackson 可以将其 serializable 序列化,但不可以 deserializable 反序列化一个 json 字符串给该 non-static inner class,详见:
http://jira.codehaus.org/browse/JACKSON-594
http://www.cowtowncoder.com/blog/archives/2010/08/entry_411.html
http://stackoverflow.com/questions/7144912/why-is-a-serializable-inner-class-not-serializable
5 @JsonCreator 。。。。。。。
老版本的jackson只能通过默认的无参构造方法
新的支持通过 @JsonCreator 来用有参构造方法来做反序列化(当同时没有无参构造方法被定义时尤其有用),并且可以基于其对 enum 做反序列化:
。。。。。。。。
http://wiki.fasterxml.com/JacksonFeatureCreators
http://stackoverflow.com/questions/11838039/jackson-3rd-party-class-with-no-default-constructor
http://stackoverflow.com/questions/9300191/how-to-annotate-enum-fields-for-deserialization-using-jackson-json?rq=1
http://stackoverflow.com/questions/8790389/jackson-deserialize-one-base-enums
引用
例子:需要反序列化的类 CacheKey 的结构如下:
6 一个ObjectMapper的使用例子:@JsonIgnoreProperties(ignoreUnknown=true) public class CacheKey implements Serializable { private String key; private CacheType cacheType; public CacheKey(String key, CacheType cacheType) { Validate.notEmpty(key, "key of CacheKey must be not empty"); Validate.notNull(cacheType, "cacheType of CacheKey must be not null"); this.key = key; this.cacheType = cacheType; } } public enum CacheType { CACHE_TYPE_A("cache-type-a", 60*60*4), // caching 4 hours CACHE_TYPE_A("cache-type-b", 60*60*24); // caching 1 day private final String prefix; // prefix of cacheType's key private int exp; // default expire time in seconds private CacheType(String prefix, int exp) { this.prefix = prefix; this.exp = exp; } }方式一:Factory-based Creator(在类 CacheKey 中添加如下静态工厂方法并注解为@JsonCreator):
public class CacheKey implements Serializable { @JsonCreator public static CacheKey fromValue(@JsonProperty("key") String key, @JsonProperty("type") String type) { CacheType cacheType = null; for (CacheType c: CacheType.values()) { if (c.getPrefix().equals(type)) { cacheType = c; } } if (null == cacheType) { throw new IllegalArgumentException("Invalid type of cache: " + type); } return new CacheKey(key, cacheType); } }方式二:Constructor-based Creator:
public class CacheKey implements Serializable { @JsonCreator public CacheKey(@JsonProperty("key") String key, @JsonProperty("type") CacheType cacheType) { Validate.notEmpty(key, "key of CacheKey must be not empty"); Validate.notNull(cacheType, "cacheType of CacheKey must be not null"); this.key = key; this.cacheType = cacheType; } } public enum CacheType { @JsonCreator public static CacheType fromPrefix(String prefix) { for (CacheType c: CacheType.values()) { if (c.getPrefix().equals(prefix)) { return c; } } throw new IllegalArgumentException("Invalid CacheType: [" + prefix + "]. Acceptable CacheType can be " + Arrays.asList(CacheType.values())); } }
ObjectMapper mapper= new ObjectMapper(); GetJSONData getJons = new GetJSONData(); String json = getJons.getJsonString(urlPath); String jsonString = json.substring(json.indexOf("\"data\":") + 7, json.length() - 1); List<RequestsCount> someClassList = mapper.readValue(jsonString, TypeFactory.defaultInstance().constructCollectionType(List.class, RequestsCount.class));
发表评论
-
页面嵌入声音
2011-06-27 20:17 1243几个选择: embed标签 bgsound标签 objec ... -
DHTMLX
2011-05-13 09:53 2382通过 Access IFRAME Content 实现 dht ... -
ajax:Add exception message to json response
2011-05-06 10:07 1922Add exception message to json r ... -
W3C DOM 之 (nodeName || tagName) && nodeType && nodeValue
2010-11-21 16:34 1269tagName和nodeName的区别 http://blog ... -
Js之appendChild() insertBefore() 和扩展的 insertAfter()
2010-11-21 16:14 2982JavaScript之appendChild、insertBe ... -
Extending js Array Prototype
2010-08-11 16:55 1285Extending array prototype with ... -
parentNode与parentElement区别 childNodes与children区别
2010-08-11 11:47 2837parentElement and children is f ... -
readonly和Disabled的区别;display:none和visible:hidden的区别
2010-07-29 11:59 4019Readonly和Disabled: http://www.c ... -
Editable Select 可编辑select
2010-03-30 18:58 7262极棒的一段Editale Select代码: http://w ... -
多用try catch做js调试
2010-03-27 15:00 2404碰到莫名其妙的js错误,多用try catch做调试! 在调 ... -
当onblur遇到focus()
2010-03-19 13:46 2075当onblur触发的function中使用了aElement. ... -
URL中文乱码问题
2010-01-22 00:19 1988解决办法: 一 使用form做提交 二 前台jsp页面编码方 ... -
页面局部刷新的两种方式:form+iframe 和 ajax
2010-01-21 14:41 167421 使用form做提交,target设为iframe的name ... -
frame,iframe,frameset之间的关系与区别
2009-11-12 15:11 1833http://www.cnblogs.com/wennxxin ... -
使用JS刷新showModalDialog窗口
2009-09-26 21:28 3705http://midnightair.iteye.com/bl ... -
getElementsByName无法获得Div
2009-09-20 14:40 2828<input name="test" ... -
js 去掉html标记 去掉换行
2009-09-16 20:15 2748mymsg=mymsg.replace(/<\/?. ... -
document.getElementById为空或不是对象的解决方法
2009-09-11 09:32 4304在使用document.getElementById时,遇到个 ... -
十大JavaScript函数 Top 10 custom JavaScript functions
2009-09-03 22:38 2066http://www.dustindiaz.com/basem ... -
关于js 中的 $()
2009-09-03 21:22 2074并不是js的什么特殊用法。其实只是你的页面引用到的js(或被i ...
相关推荐
JSON(JavaScript Object Notation)是一种轻量级、...总的来说,RFC 8259是一个对于理解和实现JSON数据格式交换至关重要的文档,它确立了JSON作为数据交换标准的地位,并为开发者提供了实现JSON数据处理的详细指南。
JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of the ...
- JSON (JavaScript Object Notation) is a lightweight data-interchange format. - It is easy for humans to read and write. - It is easy for machines to parse and generate. - It is based on a subset of ...
JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of the ...
CAJUN* is a C++ API for the JSON object interchange format. JSON is like XML, except it doesn't suck**. It is specifically designed for representing (in plain text format) structures familiar to ...
JSON is a light-weight, language independent, data interchange format. See http://www.JSON.org/ The files in this package implement JSON encoders/decoders in Java. It also includes the capability to ...
JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of the ...
数据格式(DataFormat)在IT领域中扮演着至关重要的角色,它是数据存储、传输和处理的基础。DataFormat通常指的是特定的数据表示方式,如文本、图像、音频、视频、二进制等,每种格式都有其特定的结构和规则。本文将...
JSON in Java [package org.json] Douglas Crockford douglas@crockford.com 2011-02-02 JSON is a light-weight, language independent, data interchange format. See Java使用json时用到的jar包
language-independent data interchange format. It was derived from the ECMAScript Programming Language Standard. JSON defines a small set of formatting rules for the portable representation of ...
JSON (JavaScript Object Notation) is a lightweight text-based data interchange format used to create objects to transfer data over the Internet. It's widely used today by common web applications, as ...
Chapters 3 through 12 will uncover what data is, how to convert that data into a transmittable/storable format, how to use AJAX to send and receive JSON, and, lastly, how to reassemble that data back...
什么是JSON? JSON (JavaScript Object Notation) is a lightweight data-interchange ...翻译:Json【javascript对象表示方法】,它是一个轻量级的数据交换格式,我们可以很简单的来读取和写它,并且它很容易被计算机
什么是JSON? JSON (JavaScript Object Notation) is a lightweight data-interchange ...翻译:Json【javascript对象表示方法】,它是一个轻量级的数据交换格式,我们可以很简单的来读取和写它,并且它很容易被计算机
JSON (JavaScript Object Notation) is a lightweight text-based data interchange format used to create objects to transfer data over the Internet. It's widely used today by common web applications, as ...
JSON (JavaScript Object Notation) is a light-weight data interchange format that's easy to read and write for humans and computers alike. This framework implements a strict JSON parser and generator ...
8. **Jackson-cbor**:支持CBOR(Concise Binary Object Representation),另一种高效的二进制数据格式。 9. **Jackson-module-afterburner**:一个性能优化模块,通过使用字节码增强技术提高序列化和反序列化速度...
- **JSON**:RFC7159(The JavaScript Object Notation (JSON) Data Interchange Format)是常用的数据交换格式。 这个"RFC中文文档大全"集合不仅提供了网络通信的核心协议细节,还涵盖了网络安全、网络管理、新兴...
JSON (JavaScript Object Notation) is a lightweight data-interchange format. This chapter explains how to leverage JSON to communicate with external APIs, including an example of using JSON to interact...