This repository was archived by the owner on Jan 5, 2019. It is now read-only.
File tree Expand file tree Collapse file tree
src/main/java/com/scorpiac/javarant Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ static Rant fromJson(JsonObject json) {
4848 json .get ("num_downvotes" ).getAsInt (),
4949 json .get ("text" ).getAsString (),
5050 getImage (json .get ("attached_image" )),
51- Util .jsonToList (json .get ("tags" ). getAsJsonArray ( ), JsonElement ::getAsString ).toArray (new String [0 ]),
51+ Util .jsonToList (json .getAsJsonArray ("tags" ), JsonElement ::getAsString ).toArray (new String [0 ]),
5252 json .get ("num_comments" ).getAsInt ()
5353 );
5454 }
@@ -92,7 +92,7 @@ public boolean fetchComments() {
9292 return false ;
9393
9494 // Get the comments.
95- commentsFromJson (json .get ("comments" ). getAsJsonArray ( ));
95+ commentsFromJson (json .getAsJsonArray ("comments" ));
9696
9797 return true ;
9898 }
Original file line number Diff line number Diff line change @@ -108,11 +108,11 @@ public boolean fetchData() {
108108 fetched = true ;
109109
110110 // JSON objects.
111- JsonObject profileJson = json .get ("profile" ). getAsJsonObject ( );
112- JsonObject contentJson = profileJson .get ("content" ). getAsJsonObject ( );
113- JsonObject subContentJson = contentJson .get ("content" ). getAsJsonObject ( );
114- JsonObject countsJson = contentJson .get ("counts" ). getAsJsonObject ( );
115- JsonObject avatarJson = profileJson .get ("avatar" ). getAsJsonObject ( );
111+ JsonObject profileJson = json .getAsJsonObject ("profile" );
112+ JsonObject contentJson = profileJson .getAsJsonObject ("content" );
113+ JsonObject subContentJson = contentJson .getAsJsonObject ("content" );
114+ JsonObject countsJson = contentJson .getAsJsonObject ("counts" );
115+ JsonObject avatarJson = profileJson .getAsJsonObject ("avatar" );
116116
117117 // Set all the fields.
118118 username = profileJson .get ("username" ).getAsString ();
You can’t perform that action at this time.
0 commit comments