전체보기 767

[JSON 파싱]json

메이븐 사용 시, 메이븐 레포지토리에서 json(id - org.json / version - 20200518)을 가져옵니다. 예시) JSON 파일에서 키 및 값 출력 String content; try { content = new String(Files.readAllBytes(Paths.get("파일 경로"))); JSONObject o1 = new JSONObject(content); //System.out.println(content); //json 파일 내용 Iterator iiter = o1.keys(); String key = ""; while (iiter.hasNext()) { key= iiter.next(); System.out.println("1st key : " + key); //Sys..

카테고리 없음 2020.10.15

[JSON 파싱]simple-json

json-simple : json 파일 쓰기(write), 읽기(read) 가능합니다. 메이븐 사용 시, 메이븐 리포지토리에서 json-simple (id - com.googlecode.json-simple | version - 1.1.1 ) 받아옵니다. JSON value JAVA 클래스 string java.lang.String : 문자 number java.lang.Number : 숫자 nulll null boolean Boolean : true or false Array java.util.List : JSON에서 '[]'로 표기(json-simple에서 JSONArray를 사용) Object java.util.Map : JSON에서 '{}'로 표기(key-value 형식으로 되어 있음)(json-..