RejectedSoftware Forums

Sign up

Optional fields in JSON deserialization

Hello,

it seems that the deserializeJson function requires all fields of the struct to be defined, at least according to the error it gives:

Missing non-optional field 'port' of type 'GameServer'.

is there a way to mark some fields as optional?

regards,

--Marenz

Re: Optional fields in JSON deserialization

Am 02.02.2014 17:15, schrieb Marenz:

Hello,

it seems that the deserializeJson function requires all fields of the struct to be defined, at least according to the error it gives:

Missing non-optional field 'port' of type 'GameServer'.

is there a way to mark some fields as optional?

regards,

 --Marenz


Starting with 0.7.18, you can annotate individual fields with
@optional, as well as some others (see the "Functions" list at
http://vibed.org/api/vibe.data.serialization/).

Re: Optional fields in JSON deserialization

That looks pretty awesome, thanks!

On Sun, 02 Feb 2014 17:28:18 +0100, Sönke Ludwig wrote:

Am 02.02.2014 17:15, schrieb Marenz:

Hello,

it seems that the deserializeJson function requires all fields of the struct to be defined, at least according to the error it gives:

Missing non-optional field 'port' of type 'GameServer'.

is there a way to mark some fields as optional?

regards,

 --Marenz


Starting with 0.7.18, you can annotate individual fields with
@optional, as well as some others (see the "Functions" list at
http://vibed.org/api/vibe.data.serialization/).

John

Very informative blog post.Really thank you! Keep writing. gbkgccgebeaaddgg

Good info

Very nice site!

Good info

Very nice site!

Good info

Very nice site!