반응형 TIL6 React를 위한 ES6 문법 1. let / const 2. 템플릿 리터럴(Template literal) 새로운 문자열 표기법 3. 삼항연산자와 &&연산자, ||연산자 4. 화살표함수 5. 배열 6. map https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Array/map arr.map(callback(currentValue[, index[, array]])[, thisArg]) 매개변수 callback 새로운 배열 요소를 생성하는 함수. 다음 세 가지 인수를 가집니다. currentValue 처리할 현재 요소. index Optional 처리할 현재 요소의 인덱스. array Optional map()을 호출한 배열. thisArg Opt.. 2022. 3. 6. 문자열을 JSON으로 변환하기 OKHttp Json Response OKHttp 응답값 사용하기 try { Response response = client.newCall(req).execute(); if(response.isSuccessful()) { String result = response.body().string(); // result = "{"과일":"딸기","동물":"고양이"}"; JSONParser parser = new JSONParser(); JSONObject json = (JSONObject) parser.parse(result); } } catch (IOException e) { e.printStackTrace(); } response를 문자열로 변환하고 문자열을 JSONObject로 변환했습니다. 2022. 2. 18. 이전 1 2 다음 반응형