You have a few choices depending on how you want to handle error situations. As a minor note, what you posted isn’t valid JSON ( "changes" happens as a key value thing but it’s part of a list, same thing with field and value.), which makes this a little harder to suggest concrete solutions.
If you want to be very assertive you can pattern match:
defp extract_verb(%{"entry" => [%{"changes" => [%{"value" => %{"verb" => verb}} | _]} | _]}) do
verb
end
Alternatively you could use Access to just basically return nil if things don’t match up:
You can test it yourself, none of the Elixir parsers will parse it if you copy it out of your forum post, and if you paste it into an online JSON validator you’ll get errors too. I’m assuming it’s just a copy / paste issue when you created the forum post.