JSP getting object from backend and manipulating in JS

404 Views Asked by At

I'm trying to get an array of objects in JSP, the problem is I need to manipulate the object I get later in JS, so I'm doing:

<c:forEach items="${ids}" var="idsP">
    <script>
        var object = ${idsP};
        console.log(object);      
    </script>
</c:forEach>

The problem with this code is that I get the reference to the instance of the object, so I'm getting in the console output:

co.com.processonline.entities.documentManagement.DocumentalTypeInstance@5dedbbe

If I try to get each attribute individually it works fine, but I need to get all the attributes in the object, Is there a way I can do that?

Thanks

1

There are 1 best solutions below

4
Gnk On BEST ANSWER

You need to parse to json before print in your JSP