Build a recipe app that loads JSON data and navigates to a view upon a button click. Implement a function that parses valid recipe JSON, finds the selected recipe by ID, and returns the resulting navigation state. Return the recipe list view when no click occurs or the ID is absent. Input is a JSON string containing a recipes array, a recipe ID, and a Boolean click state. Output is a dictionary containing view and recipe.
json_data is valid JSON.recipes array.id.button_clicked is a Boolean.def open_recipe_view(json_data, recipe_id, button_clicked):