<div><span style="white-space:pre;"> </span>Connection.Response response2;</div> <div><span style="white-space:pre;"> </span>Document doc3;</div> <div><span style="white-space:pre;"> </span>JsonArray entries = new JsonArray();</div> <div><span style="white-space:pre;"> </span></div> <div><span style="white-space:pre;"> </span>int index2 = 0;</div> <div><span style="white-space:pre;"> </span>for(String parse : links) {</div> <div><span style="white-space:pre;"> </span>index2++;</div> <div><span style="white-space:pre;"> </span></div> <div><span style="white-space:pre;"> </span>String parse_no= parse.substring(parse.lastIndexOf("||")).replaceAll("\\|\\|", "");</div> <div><span style="white-space:pre;"> </span>System.out.println(parse_no);</div> <div><span style="white-space:pre;"> </span>response2 = Jsoup.connect</div> <div><span style="white-space:pre;"> </span>({주소})</div> <div><span style="white-space:pre;"> </span> .method(Connection.Method.GET).ignoreContentType(true)</div> <div><span style="white-space:pre;"> </span> .execute();</div> <div><span style="white-space:pre;"> </span></div> <div><span style="white-space:pre;"> </span>doc3 = response2.parse();</div> <div><span style="white-space:pre;"> </span>Elements title = doc3.select("{셀렉터}");</div> <div><span style="white-space:pre;"> </span>System.out.println(title.text());</div> <div><span style="white-space:pre;"> </span>info.addProperty("title", title.text());</div> <div><span style="white-space:pre;"> </span>entries.add(info);</div> <div><span style="white-space:pre;"> </span></div> <div><span style="white-space:pre;"> </span></div> <div><span style="white-space:pre;"> </span>}</div> <div><span style="white-space:pre;"> </span></div> <div><span style="white-space:pre;"> </span>System.out.println(entries.toString());</div> <div><br></div> <div><br></div> <div><br></div> <div>이 코드의 sysout</div> <div> <div>[{"title":"찾은제목1"},{"title":"찾은제목1"},{"title":"찾은제목1"}]</div></div> <div><br></div> <div>이런식으로 출력됩니다.</div> <div><br></div> <div>[{"title":"찾은제목1"},{"title":"찾은제목2"},{"title":"찾은제목3"}]</div> <div><br></div> <div>이렇게 나와야하는건데요...</div> <div><br></div> <div>분명하기 links의 사이즈는 3이며 각각 다른 정보가 들어가있습니다.</div> <div><br></div> <div>결론 -</div> <div><br></div> <div>json오브젝트로 만들기위해 addproperty를 해놓으면 같은 데이터가 3개가 들어가버립니다.</div> <div><br></div> <div><br></div> <div>만약 <span style="font-size:9pt;">info.addProperty("title"+</span><span style="font-size:9pt;">index2</span><span style="font-size:9pt;">, title.text()); 이렇게한다면 들어가지만 json오브젝트 이름이 달라져 원하는것이 아닙니다.</span></div> <div><span style="font-size:9pt;"><br></span></div>
<div style="text-align:center;"><img src="http://eusave.dothome.co.kr/gif.php?id=0B9kuz3bbrNKXOG1iYnZIckZzMEU" alt="iu.jpg" style="font-size:9pt;line-height:1.5;border:none;"></div>
<div style="text-align:center;"><img_ src="http://eusave.dothome.co.kr/gif.php?id=0B4MpkGgWbWt6T2lObjI2d293VW8" alt="iu.jpg" style="font-size:9pt;line-height:1.5;border:none;"></div>
<div style="text-align:center;"><img_ src="http://eusave.dothome.co.kr/gif.php?id=0B1-Nk0QyKrjDeVlnM3hCYllaRkk" alt="iu.jpg" style="font-size:9pt;line-height:1.5;border:none;"></div>
<div style="text-align:center;">
<div style="text-align:center;"><img_ src="http://eusave.dothome.co.kr/gif.php?id=0B1-Nk0QyKrjDeVlnM3hCYllaRkk" alt="iu.jpg" style="font-size:9pt;line-height:1.5;border:none;"></div>
<div style="text-align:center;">
<div style="text-align:center;"><img_ src="http://eusave.dothome.co.kr/gif.php?id=0B1-Nk0QyKrjDRWlMa09ieDZsMlE" alt="iu.jpg" style="font-size:9pt;line-height:1.5;border:none;"></div>
<div style="text-align:center;">
<div style="text-align:center;"><img_ src="http://eusave.dothome.co.kr/gif.php?id=0B8fuRvQ1iHqPX0lRN2drTXU5OWc" alt="iu.jpg" style="font-size:9pt;line-height:1.5;border:none;"></div>
<div style="text-align:center;"></div></div></div></div>