I'm trying to get rid of the JSON object from the fake. When I compile, I get this error:
Error: package org.json does not exist C: \ workspace \ tutorial \ app \ controllers \ Application.java: 18 15 model models .Device; 16 model models. Task; 17 18import Org (.) Jason. Jason Aurere; - & gt; Error 19import org.json.JSONException; 20 21import play.data.Form; 22import play.db.ebean.Model; 23import play.mvc.Controller; This is my code:
Public Static Results Index () throws JSONException, IOException {JSONArray json = readJsonFromUrl ("http: // htejera. Ukelelestudio .com / imitation / dmamock / devices / android "); Return is OK (index.render (json.toString ())); } Private Stable String ReadLL (Reader RD) throws IOException {StringBuilder sb = New StringBuilder (); Int cp; While ((cp = rd.read ())! = -1) {sb.append ((four) cp); } Return sb.toString (); } Public static JSONArray readJsonFromUrl (string URL) throws IOException, JSONException {InputStream = New URL (. Url) .openstream (); Try {BufferedReader rd = New BufferedReader (New InputStreamReader (Charset.forName ("UTF-8")); String jsontext = readAll (rd); JSONArray json = New JSONArray (jsontext); Return json; } Finally {is.close () is; }} I've added librarydrive ++ "org.json"% "json"% "20140107" to plugins. Sbt
No comments:
Post a Comment