使用Java操作JSON字符串对象

Posted by eDWARD at 10:14

  1. 如果我们需要实现一个配置管理的功能,那么为每个配置项目增加一个字段既复杂也不利于扩展,所以我们通常使用一个字符串来保存配置项目信息,这里介绍如何使用json的字符串解析来达到刚才说的目的。引入Json需要的类库:
  2. 生成一个json对象(可以添加不同类型的数据):
  3. 解析一个json对象(可以解析不同类型的数据):

    getJSONObject(String str)

    这样我们不仅可以处理多种数据类型,还可以随时添加配置相,这种方式相当灵活。

Filed In 学习路上 | Study | Tags: , , | 3 Comments »

Your Comments.

Leave your own response

3 Responses to “使用Java操作JSON字符串对象”

Leave a Reply.

Comment Form.

Fields denoted with a "*" are required. Your comment may require moderation, please be patient.

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>




Your Reply.

Use the following link to trackback from your own site:
http://www.zhangzhang.net/2008/01/use-json-object/trackback/

Spread the word.

Octopus supports RSS feed for this post RSS 2.0 , and Trackbacks from other blogs.


Fatal error: Call to undefined function get_single_sidebar() in /home/zhangzha/public_html/wp-content/themes/octopus/single.php on line 69