Search Issue Tracker

Fixed in 2020.2.X

Fixed in 2019.4.X, 2021.1.X

Votes

26

Found in

2017.4

2018.4

2019.2

2019.2.10f1

2019.3

2020.1

2020.2.0a15

Issue ID

1201453

Regression

No

"Unexpected node type." Error is thrown and no Exception is caught when using JsonUtility.FromJsonOverwrite function

Serialization

-

How to reproduce:
1. Open the attached project's Scene labeled "Test"
2. Enter the Play Mode
3. Observe the Console Window

Expected result: An Exception is thrown related to the "Unexpected node type." Error warning about the wrong format
Actual result: "Unexpected node type." Error is thrown but no Exception is caught

Reproducible with: 2017.4.35f1, 2018.4.13f1, 2019.2.15f1, 2019.3.0f1, 2020.1.0a15, 2020.2.0a15.

Note: Old format JSON is used

  1. Resolution Note (fix version 2020.2):

    Error message has been removed because it was not helpful. In cases like this it is expected that JSON data for a field may need to be ignored if it cannot be converted to the current field type of an class. Fixed in Unity 2021.2.0a1

  2. Resolution Note (fix version 2021.1):

    Fixed in Unity 2021.1.0b6

  3. Resolution Note (fix version 2020.2):

    Fixed in Unity 2020.2.6f1

  4. Resolution Note (fix version 2019.4):

    Fixed in Unity 2019.4.21f1

Comments (5)

  1. samran263

    Feb 15, 2023 06:27

    Same problem.
    Still happens on Unity 2021.3.11f1.
    any solution?

  2. zalogic

    Jun 02, 2020 09:21

    Extra details: the issue ONLY happens if the target object where the json is deserialized has a field of array type and the json contains that field with a non-array type.

    If it's the other way around and the target object contains a non-array type field and that field in the json has a different type (numeric, array, etc) it will not crash and will be silently ignored.

  3. cristiscripcaru

    Jun 01, 2020 09:32

    I have the same problem. When can you fix it?

  4. FanStudioUK

    May 29, 2020 07:16

    Same here!
    You only need to throw an exception...

    Come on guys, it's an easy fix :)

  5. zalogic

    May 28, 2020 10:06

    Same problem.
    Still happens on Unity 2019.3.14f1.
    No catch-able exception is thrown.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.