Actually, I have 2 questions for this. I have a json like this
[
{
"id": 601,
"imdb_id": "tt0068646",
"imdb_rating": "9.2",
"language": "English, Italian, Latin",
"poster": "https://m.media-amazon.com/images/M/MV5BM2MyNjYxNmUtYTAwNi00MTYxLWJmNWYtYzZlODY3ZTk3OTFlXkEyXkFqcGdeQXVyNzkwMjQ5NzM@._V1_SX300.jpg",
"title": "The Godfather",
"year": 1972
},
{
"id": 603,
"imdb_id": "tt0071562",
"imdb_rating": "9.0",
"language": "English, Italian, Spanish, Latin, Sicilian",
"poster": "https://m.media-amazon.com/images/M/MV5BMWMwMGQzZTItY2JlNC00OWZiLWIyMDctNDk2ZDQ2YjRjMWQ0XkEyXkFqcGdeQXVyNzkwMjQ5NzM@._V1_SX300.jpg",
"title": "The Godfather Part II",
"year": 1974
},
{
"id": 622,
"imdb_id": "tt0108052",
"imdb_rating": "9.0",
"language": "English, Hebrew, German, Polish, Latin",
"poster": "https://m.media-amazon.com/images/M/MV5BNDE4OTMxMTctNmRhYy00NWE2LTg3YzItYTk3M2UwOTU5Njg4XkEyXkFqcGdeQXVyNjU0OTQ0OTY@._V1_SX300.jpg",
"title": "Schindler's List",
"year": 1993
}
]
After do a json2html and return like this
movies_data = get_recommended_movies().json
for movie_data in movies_data:
imdb_id = movie_data["imdb_id"]
movie_data["imdb_id"] = "https://www.imdb.com/title/" + imdb_id
#movies_data = json.dumps(get_recommended_movies().json)
html_data = json2html.convert(json=movies_data)
return html_data
The webpage is rendered with a table. My question is that how to render the poster url as an image in the table and. How to display it as a clickable URL in the table
It's not possible with that library, cannot supports html templates, only transform json to a html table
You can try to add some javascript, but my recommendation is use other library, the latest version it's too old (Jul 3, 2019)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.