hutool工具类读取本地json文件

[
    {
        "version":1,
        "materialName":"Zirconia",
        "materialCode":"ZIRCONIA"
    }
]
package com.lezu.springboot.test;

import cn.hutool.core.io.file.FileReader;
import com.alibaba.fastjson.JSONArray;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.test.context.SpringBootTest;

/**
 * @author lianJiaYu
 * @date 2024/7/05
 */
@SpringBootTest
@Slf4j
public class LianTest {


    public static void main(String[] args) throws Exception {
        JSONArray jsonArray = JSONArray.parseArray(new FileReader("C:\\Users\\jiayu.lian\\Desktop\\test.json").readString());
        System.out.println(jsonArray);



}

posted @ 2024-07-05 17:30  难忘是想起  阅读(0)  评论(0)    收藏  举报  来源