Skip to content

Uncaught TypeError: Converting circular structure to JSON #881

@gkpo

Description

@gkpo

Hi there,

Here is my data structure:

{
name: "Tasklist name",
tasks: [{
name: "Plant a tree"
}, {
name: "Say hi to Grandpa"
}]
}

I called:

Restangular.one("tasklists", 123).get().then(function(tasklist) {
Restangular.restangularizeCollection(tasklsit, tasklist.tasks, 'tasks');
});

This works fine. However, when I call task.put(), it throws a TypeError: Converting circular structure to JSON.
This is because the task element contains a "element" attribute, probably added by angular while iterating through the list.
If I set it to null before sending the request, it gets converted to json properly and works.

Is there a way I can tell Restangular how to serialize my object (and ignore the element attribute)?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions