when traversing an array using Thymelaf loops in hmlt
<div th:each="c : ${blog.categories}">
<span class="label label-primary" th:text="${c}"></span>
</div>
the display on the page is as follows
because here ${blog.categories}
is a string rather than an array object! In JS, JSON.parse ()
is fine, but how to solve this problem?