{"id":100,"date":"2019-07-10T23:48:19","date_gmt":"2019-07-10T14:48:19","guid":{"rendered":"http:\/\/www.space4u.co.kr\/wp\/?p=100"},"modified":"2019-07-10T23:48:21","modified_gmt":"2019-07-10T14:48:21","slug":"android%ec%97%90%ec%84%9c-json-%eb%8d%b0%ec%9d%b4%ed%84%b0%eb%a5%bc-%ec%86%a1%ec%88%98%ec%8b%a0","status":"publish","type":"post","link":"http:\/\/www.space4u.co.kr\/wp\/?p=100","title":{"rendered":"Android\uc5d0\uc11c JSON \ub370\uc774\ud130\ub97c \uc1a1\uc218\uc2e0"},"content":{"rendered":"\n<p> Android\uc5d0\uc11c JSON \ub370\uc774\ud130\ub97c \uc1a1\uc218\uc2e0\ud558\uae30 \uc704\ud574\uc11c HttpURLConnection\uc744 \uc0ac\uc6a9\ud558\uc5ec \ub9cc\ub4e0 \ud568\uc218 \uc785\ub2c8\ub2e4. <\/p>\n\n\n\n<ul><li>serverURL : JSON \uc694\uccad\uc744 \ubc1b\ub294 \uc11c\ubc84\uc758 URL<\/li><li>postPara : POST \ubc29\uc2dd\uc73c\ub85c \uc804\ub2ec\ub420 \uc785\ub825 \ub370\uc774\ud130<\/li><li>flagEncoding : postPara \ub370\uc774\ud130\uc758 URLEncoding \uc801\uc6a9 \uc5ec\ubd80<\/li><li>\ubc18\ud658 \ub370\uc774\ud130 : \uc11c\ubc84\uc5d0\uc11c \uc804\ub2ec\ub41c JSON \ub370\uc774\ud130<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>public static String getJson(String serverUrl, String postPara, boolean flagEncoding) throws Exception {\n         URL url = null;\n         HttpURLConnection conn = null;\n         PrintWriter postReq = null;\n         BufferedReader postRes = null;\n         StringBuilder json = null;\n         String line = null;\n\njson = new StringBuilder();\ntry {\n    if (flagEncoding) {\n        postPara = URLEncoder.encode(postPara);\n    }\n\n    url = new URL(serverUrl);\n    conn = (HttpURLConnection) url.openConnection();\n    conn.setDoOutput(true);\n    conn.setUseCaches(false);\n    conn.setRequestMethod(\"POST\");\n    conn.setRequestProperty(\"Content-Type\", \"text\/plain\");\n    conn.setRequestProperty(\"Content-Length\", \n                                               Integer.toString(postPara.length()));\n    conn.setDoInput(true);\n\n    postReq = new PrintWriter(\n                      new OutputStreamWriter(conn.getOutputStream(), \"UTF-8\"));\n    postReq.write(postPara);\n    postReq.flush();\n\n    postRes = new BufferedReader(\n                     new InputStreamReader(conn.getInputStream(), \"UTF-8\"));\n    while ((line = postRes.readLine()) != null){\n        json.append(line);\n    }\n    conn.disconnect();\n} catch (MalformedURLException ex) {\n    throw new Exception(ex.getMessage());\n} catch (IOException ex) {\n    throw new Exception(ex.getMessage());\n} catch (Exception ex) {\n    throw new Exception(ex.getMessage());\n}\nreturn json.toString(); \n}   <\/code><\/pre>\n\n\n\n<p>\n\n\ucd9c\ucc98 :&nbsp;<a href=\"http:\/\/www.jopenbusiness.com\/tc\/oss\/entry\/Android%EC%97%90%EC%84%9C-Json-%EC%82%AC%EC%9A%A9%ED%95%98%EC%97%AC-%ED%86%B5%EC%8B%A0%ED%95%98%EA%B8%B0-1?category=15\">http:\/\/www.jopenbusiness.com\/tc\/oss\/entry\/Android\uc5d0\uc11c-Json-\uc0ac\uc6a9\ud558\uc5ec-\ud1b5\uc2e0\ud558\uae30-1?category=15<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Android\uc5d0\uc11c JSON \ub370\uc774\ud130\ub97c \uc1a1\uc218\uc2e0\ud558\uae30 \uc704\ud574\uc11c HttpURLConnection\uc744 \uc0ac\uc6a9\ud558\uc5ec \ub9cc\ub4e0 \ud568\uc218 \uc785\ub2c8\ub2e4. serverURL : JSON \uc694\uccad\uc744 \ubc1b\ub294 \uc11c\ubc84\uc758 URL postPara : POST \ubc29\uc2dd\uc73c\ub85c \uc804\ub2ec\ub420 \uc785\ub825 \ub370\uc774\ud130 flagEncoding&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"http:\/\/www.space4u.co.kr\/wp\/?p=100\">\ub354 \uc77d\uae30<span class=\"screen-reader-text\">Android\uc5d0\uc11c JSON \ub370\uc774\ud130\ub97c \uc1a1\uc218\uc2e0<\/span> <i class=\"fas fa-angle-right\"><\/i><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[51],"aioseo_notices":[],"_links":{"self":[{"href":"http:\/\/www.space4u.co.kr\/wp\/index.php?rest_route=\/wp\/v2\/posts\/100"}],"collection":[{"href":"http:\/\/www.space4u.co.kr\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.space4u.co.kr\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.space4u.co.kr\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.space4u.co.kr\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=100"}],"version-history":[{"count":1,"href":"http:\/\/www.space4u.co.kr\/wp\/index.php?rest_route=\/wp\/v2\/posts\/100\/revisions"}],"predecessor-version":[{"id":101,"href":"http:\/\/www.space4u.co.kr\/wp\/index.php?rest_route=\/wp\/v2\/posts\/100\/revisions\/101"}],"wp:attachment":[{"href":"http:\/\/www.space4u.co.kr\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=100"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.space4u.co.kr\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=100"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.space4u.co.kr\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=100"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}