Package twitter4j.org.json

Examples of twitter4j.org.json.JSONArray


            JSONObject trendsJson = json.getJSONObject("trends");
            trends = new ArrayList<Trends>(trendsJson.length());
            Iterator ite = trendsJson.keys();
            while (ite.hasNext()) {
                String key = (String) ite.next();
                JSONArray array = trendsJson.getJSONArray(key);
                Trend[] trendsArray = jsonArrayToTrendArray(array);
                if (key.length() == 19) {
                    // current trends
                    trends.add(new Trends(res, asOf, parseDate(key
                            , "yyyy-MM-dd HH:mm:ss"), trendsArray));
View Full Code Here


    /*package*/
    static Trends constructTrends(Response res) throws TwitterException {
        JSONObject json = res.asJSONObject();
        try {
            Date asOf = parseDate(json.getString("as_of"));
            JSONArray array = json.getJSONArray("trends");
            Trend[] trendsArray = jsonArrayToTrendArray(array);
            return new Trends(res, asOf, asOf, trendsArray);
        } catch (JSONException jsone) {
            throw new TwitterException(jsone.getMessage() + ":" + res.asString(), jsone);
        }
View Full Code Here

     * @return response body as twitter4j.org.json.JSONArray
     * @throws TwitterException
     */
    public JSONArray asJSONArray() throws TwitterException {
        try {
            return new JSONArray(asString());
        } catch (JSONException jsone) {
            throw new TwitterException(jsone.getMessage() + ":" + this.responseAsString, jsone);
        }
    }
View Full Code Here

            resultsPerPage = json.getInt("results_per_page");
            warning = getString("warning", json, false);
            completedIn = json.getDouble("completed_in");
            page = json.getInt("page");
            query = getString("query", json, true);
            JSONArray array = json.getJSONArray("results");
            tweets = new ArrayList<Tweet>(array.length());
            for (int i = 0; i < array.length(); i++) {
                JSONObject tweet = array.getJSONObject(i);
                tweets.add(new Tweet(tweet, twitterSupport));
            }
        } catch (JSONException jsone) {
            throw new TwitterException(jsone.getMessage() + ":" + json.toString(), jsone);
        }
View Full Code Here

    /*package*/ SavedSearch(JSONObject savedSearch) throws TwitterException {
        init(savedSearch);
    }

    /*package*/ static List<SavedSearch> constructSavedSearches(Response res) throws TwitterException {
            JSONArray json = res.asJSONArray();
            List<SavedSearch> savedSearches;
            try {
                savedSearches = new ArrayList<SavedSearch>(json.length());
                for(int i=0;i<json.length();i++){
                    savedSearches.add(new SavedSearch(res,json.getJSONObject(i)));
                }
                return savedSearches;
            } catch (JSONException jsone) {
                throw new TwitterException(jsone.getMessage() + ":" + res.asString(), jsone);
            }
View Full Code Here

TOP

Related Classes of twitter4j.org.json.JSONArray

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.