JSON-IO

码农软件 · 软件分类 · JSON/BSON开发包 · 2019-04-01 07:13:10

软件介绍

JAVA平台下的一款,序列化反序列化工具,重点在于

1.可以直接把JSON反序列化为对象.

2.可反序列化深层复杂的对象.

3.可序列化循环引用等复杂对象.

4.可序列化静态类和内部类.

 

json-io can be used directly on JSON Strings or with Java's Streams.

Example 1: String to Java object

    Object obj = JsonReader.jsonToJava("[\"Hello, World\"]");

This will convert the JSON String to a Java Object graph. In this case, it would consist of an Object[] of one String element.

Example 2: Java object to JSON String

    Employee emp;     // Emp fetched from database     String json = JsonWriter.objectToJson(emp);

This example will convert the Employee instance to a JSON String. If the JsonReader were used on this String, it would reconstitute a JavaEmployee instance.

Example 3: InputStream to Java object

    JsonReader jr = new JsonReader(inputStream);     Employee emp = (Employee) jr.readObject();

In this example, an InputStream (could be from a File, the Network, etc.) is supplying an unknown amount of JSON. The JsonReader is used to wrap the stream to parse it, and return the Java object graph it represents.

Example 4: Java Object to OutputStream

    Employee emp;     // emp obtained from database     JsonWriter jw = new JsonWriter(outputStream);     jw.write(emp);     jw.close();

 

 

本文地址:https://codercto.com/soft/d/2600.html

编程语言实现模式

编程语言实现模式

Terence Parr / 李袁奎、尧飘海 / 华中科技大学出版社 / 2012-3-20 / 72.00元

《编程语言实现模式》旨在传授开发语言应用(工具)的经验和理念,帮助读者构建自己的语言应用。这里的语言应用并非特指用编译器或解释器实现编程语言,而是泛指任何处理、分析、翻译输入文件的程序,比如配置文件读取器、数据读取器、模型驱动的代码生成器、源码到源码的翻译器、源码分析工具、解释器,以及诸如此类的工具。为此,作者举例讲解已有语言应用的工作机制,拆解、归纳出31种易于理解且常用的设计模式(每种都包括通......一起来看看 《编程语言实现模式》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具