glenjamin / transit-immutable-js

Transit serialisation for Immutable.js
MIT License
250 stars 31 forks source link

Error serializing unrecognized object [object Object] #28

Open gajus opened 8 years ago

gajus commented 8 years ago

I am getting an error:

error Error: Error serializing unrecognized object [object Object]

Here is the JSON input:

https://gist.github.com/gajus/bdd5b3d8cd0ddce24e762495d9779a75

Here is how I load it:

transit.toJSON(Immutable.fromJS(jsonInput))
glenjamin commented 8 years ago

I recommend running this in the debugger and finding out exactly which object it is that is producing that error.

Griezzly commented 8 years ago

I have the same issue. It seems to have problems with ArrayMapNode Objects. The debuggers output of the object is this one: Image of Object

glenjamin commented 8 years ago

Hrm, you shouldn't really get a raw ArrayMapNode like that - they should be contained inside an actual Map.

Can you share a code sample which reproduces this problem please?

Griezzly commented 8 years ago

Thats a bit more complicated. Im basically using ReactJS with Redux to store the state of my application in an immutable map. Problem is that a lot of that happens in the background and i havent completely figured it out myself how exactly the objects look after creating them since they are created by a libary. But basically its this issue: https://github.com/rt2zz/redux-persist-transform-immutable/issues/13

I will investigate a bit further

sebastientromp commented 4 years ago

I'm also facing this exception when serializing a simple javascript object:

[
    {
        "id": "hero-selection",
        "name": "Hero Selection",
        "panels": [
            {
                "id": "bgs-hero-selection-overview",
                "name": "Hero Selection",
                "heroOverview": []
            }
        ]
    },
    {
        "id": "in-game",
        "name": "In Game",
        "panels": [
            {
                "id": "bgs-next-opponent-overview",
                "name": "Next opponent",
                "opponentOverview": null
            }
        ]
    },
    {
        "id": "post-match",
        "name": "Post-match stats",
        "panels": [
            {
                "id": "bgs-post-match-stats",
                "name": "Post-match stats",
                "stats": null
            }
        ]
    }
]

The error is

Error serializing unrecognized object [object Object]