Java fastjson 解析json配置文件
来源:互联网 发布:java常用算法手册评价 编辑:程序博客网 时间:2024/05/16 08:53
需要准备下面工具:
fastjsoncommon-io(文件转化为Stirng)网址:http://www.bejson.com/json2javapojo/ (JSON字符串转换成Java实体类(POJO))
json格式如下
{ "QRratio": { "x": 111, "y": 111, "width": 4000, "height": 4000 }, "Interleaved2of5": { "x": 111, "y": 111, "width": 4000, "height": 4000 }, "comment": "不同分辨率的情况下获取的区域不一样"}
生成Java实体类
核心代码块
//配置不同分辨率下不同的QR 和 25 码的配置文件 InputStream inputStream = new FileInputStream("config/billtype.conf.json"); String text = IOUtils.toString(inputStream,"utf8"); Root root = JSON.parseObject(text,Root.class);
导包
import com.alibaba.fastjson.JSON;import com.xudaolong.bean.config.Root;import org.apache.commons.io.IOUtils;import java.io.File;import java.io.FileInputStream;
0 0
- Java fastjson 解析json配置文件
- java json解析fastjson jackson
- Java解析json(三):fastjson
- JSON的解析[Java-JSON、FastJSON、GSON]
- JAVA-使用FastJson解析复杂JSON数据
- Java构造和解析Json数据-fastjson
- Java的Json解析包FastJson使用
- Json解析,FastJson解析
- JSON 之FastJson解析
- Android FastJson,json解析
- JSON 之FastJson解析
- JSON 之FastJson解析
- Json解析之FastJson
- JSON 之FastJson解析
- JSON 之FastJson解析
- JSON 之FastJson解析
- JSON 之FastJson解析
- JSON 之FastJson解析
- PLSQL基本语法
- php7.0及mysql、gd扩展安装
- spring dubbo 配置环境报错
- apache-shiro详解
- C语言指针传参问题
- Java fastjson 解析json配置文件
- 天纵智能软件快速开发平台便签插件
- Light oj 1307 - Bi-shoe and Phi-shoe【欧拉函数】
- [JS]JS面向对象编程——原型继承
- 带TargetStackTraceElement的log工具类
- Java 图片切割
- Cadence : 如何去掉Orcad Capture中元件标号下划线
- uisegmentedcontrol类重写,自定义按钮和背景颜色
- haporxy 负载elasticsearch