package com.sf.vertx;

import java.util.List;

import org.junit.Test;

import com.alibaba.fastjson2.JSON;
import com.sf.vertx.api.pojo.Node;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class TestJson {

	@Test
	public void json() {
		String oldGoodsStorageModes = " [\n"
				+ "        {\n"
				+ "            \"createHttp\": true,\n"
				+ "            \"createHttps\": false,\n"
				+ "            \"ip\": \"localhost\",\n"
				+ "            \"port\": \"9198\"\n"
				+ "        },\n"
				+ "        {\n"
				+ "            \"createHttp\": true,\n"
				+ "            \"createHttps\": false,\n"
				+ "            \"ip\": \"localhost\",\n"
				+ "            \"port\": \"9199\"\n"
				+ "        }\n"
				+ "    ]";//解析成字符串
		//字符串转list
		List<Node> oldGoodsStoragemodes = JSON.parseArray(oldGoodsStorageModes,Node.class);
		log.info("oldGoodsStoragemodes:{}", JSON.toJSONString(oldGoodsStoragemodes));
	}
}
