Play Framework Java 2.3.8 - JSon -


im trying json object mock. when compile got error :

error: package org.json not exist in c:\workspace\tutorial\app\controllers\application.java:18 15import models.device;    16import models.task; 17 18import org(.)json.jsonarray; --> error  19import org.json.jsonexception; 20 21import play.data.form; 22import play.db.ebean.model; 23import play.mvc.controller; 

this code:

public static result index() throws jsonexception, ioexception {     jsonarray json = readjsonfromurl("http://htejera.ukelelestudio.com/mock/dmamock/devices/android");     return ok(index.render(json.tostring())); }   private static string readall(reader rd) throws ioexception {     stringbuilder sb = new stringbuilder();     int cp;     while ((cp = rd.read()) != -1) {         sb.append((char) 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(is,                 charset.forname("utf-8")));         string jsontext = readall(rd);         jsonarray json = new jsonarray(jsontext);         return json;     } {         is.close();     } } 

i have added librarydependencies += "org.json" % "json" % "20140107" plugins.sbt


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -