diff --git a/src/privatebin.rs b/src/privatebin.rs index d6b4ce2..c9b7761 100644 --- a/src/privatebin.rs +++ b/src/privatebin.rs @@ -229,15 +229,14 @@ impl Paste { }) .collect(); json!({ - id: { - "comment": decrypted_comments.get(id).unwrap_or(&DecryptedComment::default()).comment, - "nickname": decrypted_comments.get(id).unwrap_or(&DecryptedComment::default()).nickname, - "replies": formatted_children - } + "id": id, + "comment": decrypted_comments.get(id).unwrap_or(&DecryptedComment::default()).comment, + "nickname": decrypted_comments.get(id).unwrap_or(&DecryptedComment::default()).nickname, + "replies": formatted_children }) } let top_level = format_comments_below_id(&self.id, decrypted_comments, comment_adjacency); - serde_json::to_string_pretty(&top_level[&self.id]["replies"]).map_err(|e| e.into()) + serde_json::to_string_pretty(&top_level["replies"]).map_err(|e| e.into()) } }