Search Feedback

198
votes

Add support for Nullable Types to JsonUtility

Scripting

-

-

Unity’s JsonUtility (docs.unity3d.com/ScriptReference/JsonUtility) doesn’t support the additional null value of the serialized Nullable Types (docs.microsoft.com/en-us/dotnet/csharp/programming-guide/nullable-types).

The ability to assign null to numeric and Boolean types is especially useful when dealing with databases and other data types that contain elements that may not be assigned a value. For example, a Boolean field in a database can store the values true or false, or it may be undefined.

Comments (2)

  1. 019564238c4171803b57962033932d21?d=mm

    VadimPyrozhok

    Sep 24, 2018 10:47

    I have to admit this is a problem. It would be much easier to have normally serialized fields like "TeamNumber": null , instead of having "TeamNumber": ""
    So we as developers wouldn't have to come up with some strange tricky solutions for sending normal POST requests.

  2. 6a51bb25c72b938fed68ec22d75ab43c?d=mm

    earthcrosser

    Sep 04, 2018 15:50

    It would be great if you could leave out values from the JSON string as well. Like if you have a value that is null, it gets skipped and doesn't show up in the JSON string that is created.

Your opinion counts

Help us make things better. Share your great idea for improving Unity or vote for other people’s.

Log in to post a new idea

Categories

All

(10535)

2D

(274)

Ads

(52)

AI & Navigation

(78)

Analytics

(125)

Animation

(390)

Asset Store

(333)

Asset Store Publisher

(10)

Assets

(536)

Audio

(176)

Cloud Build

(139)

Collaborate

(57)

Docs & Tutorials

(238)

Editor

(2459)

Everyplay

(15)

Game Performance Reporting

(15)

General

(953)

Graphics

(861)

GUI

(423)

Input

(166)

Licensing

(88)

Networking

(185)

Physics

(380)

Platforms

(438)

Profiling & Optimization

(81)

Runtime

(180)

Scripting

(1148)

Terrain

(168)

WebGL

(141)