Very strange behavior, most probably a bug in my code:
I get an API response object (json) and when I setState using one of the object's properties as value, the object changes. I thought this was a problem with the backend or fetch method, but it has been proven not to be.
Code is generally as follows:
fetch(this.props.url, {
    method: 'POST',
    body: JSON.stringify({
        class: 'property',
        action: 'view', 
        objectId: this.props.element.id,
        token: this.props.token,
    }),
})
    .then(response => response.json())
    .then(json => {
        this.setState({
            property: json.property
        });
        console.log(json);
    })
What I am supposed to get:
{
        property: {
            units: {
                {
                    id: 31,
                    ...
                },
                {
                    id: 33,
                    ...
                }
            }
        }
    }
{
What I actually get:
    property: {
        units: {
            {
                id: 33,
                ...
            },
            {
                id: 33,
                ...
            }
        }
    }
}
Needless to say, response from backend is with the proper ids, which are unique.
Any ideas what I might have done wrong? This is not supposed to happen, is it? How does the json variable change?
Thanks.
