Is there a prettier way to parse & get data from JSON ?

52 points prcessor

In any simpler language like PHP for example, getting the title of a reddit post from the reddit API would be as simple as :

$post['data']['title]

However I had to do this in rust to simply get that title attribute

p.get("data").unwrap().get("title").unwrap().to_string()

So getting multiple attributes the same way just ended up looking very ugly.

Can someone guide me through a prettier / simpler way to do it ?

https://preview.redd.it/os20mej5mwq81.png?width=2114&format=png&auto=webp&s=7d7e173a624789834d1c43c5ed6ff5144a3ed84c