Skip to content

Serializing Guid type throws JsonException #127

@srprash

Description

@srprash

Hi,
Looking at this issue opened with our repo, I realized that LitJSON doesn't handle serializing Guid type very well and throws the following error:

Unhandled exception. LitJson.JsonException: Max allowed object depth reached while trying to export from type System.Guid
   at LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in C:\projects\litjson\src\LitJson\JsonMapper.cs:line 725
   at LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in C:\projects\litjson\src\LitJson\JsonMapper.cs:line 861
   at LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in C:\projects\litjson\src\LitJson\JsonMapper.cs:line 861
   at LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in C:\projects\litjson\src\LitJson\JsonMapper.cs:line 861

More details along with a repro code are on the issue. Let me know if there's a way to handle Guid without special casing. Would be happy to do a PR. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions