You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ignite.apache.org by Alexey Kuznetsov <ak...@gridgain.com> on 2016/06/16 09:15:32 UTC

Change rest-http Java to JSON null transformation logic

Hi All!

I'm working on migrating from outdated json-lib to Jackson issue
IGNITE-3277 [1] and found that previous library serialize null strings as
"" and null objects as "null", for example:
{"a": "", "b": null}

How about to serialize all values as "null" ?
In this case we would definitely know that in Java before serialization to
JSON was really NULL, not empty string.

But this may break compatibility in some cases.

Thoughts?


1. https://issues.apache.org/jira/browse/IGNITE-3277

-- 
Alexey Kuznetsov
GridGain Systems
www.gridgain.com

Re: Change rest-http Java to JSON null transformation logic

Posted by Alexey Kuznetsov <ak...@gridgain.com>.
Vlad,

Actually I implemented 2 custom serializers: one for null strings and
another for null objects.
But I think that it looks like a "workaround" for me.

On Thu, Jun 16, 2016 at 4:44 PM, Vladislav Pyatkov <vp...@gridgain.com>
wrote:

> Hello,
>
> Why do you want this, if you can save full compatibility using custom
> serializer for null value (ObjectMapper#setSerializerProvider)?
>
> On Thu, Jun 16, 2016 at 12:15 PM, Alexey Kuznetsov <
> akuznetsov@gridgain.com> wrote:
>
>> Hi All!
>>
>> I'm working on migrating from outdated json-lib to Jackson issue
>> IGNITE-3277 [1] and found that previous library serialize null strings as
>> "" and null objects as "null", for example:
>> {"a": "", "b": null}
>>
>> How about to serialize all values as "null" ?
>> In this case we would definitely know that in Java before serialization
>> to JSON was really NULL, not empty string.
>>
>> But this may break compatibility in some cases.
>>
>> Thoughts?
>>
>>
>> 1. https://issues.apache.org/jira/browse/IGNITE-3277
>>
>> --
>> Alexey Kuznetsov
>> GridGain Systems
>> www.gridgain.com
>>
>
>


-- 
Alexey Kuznetsov
GridGain Systems
www.gridgain.com

Re: Change rest-http Java to JSON null transformation logic

Posted by Alexey Kuznetsov <ak...@gridgain.com>.
Pavel, in this case object will be serialized like : {"a": "null"} compare
with {"a": null}

On Thu, Jun 16, 2016 at 4:49 PM, Pavel Tupitsyn <pt...@gridgain.com>
wrote:

> Hi,
>
> What if there is an actual string with "null" value?
>
> Pavel.
>
> On Thu, Jun 16, 2016 at 12:44 PM, Vladislav Pyatkov <vpyatkov@gridgain.com
> > wrote:
>
>> Hello,
>>
>> Why do you want this, if you can save full compatibility using custom
>> serializer for null value (ObjectMapper#setSerializerProvider)?
>>
>> On Thu, Jun 16, 2016 at 12:15 PM, Alexey Kuznetsov <
>> akuznetsov@gridgain.com> wrote:
>>
>>> Hi All!
>>>
>>> I'm working on migrating from outdated json-lib to Jackson issue
>>> IGNITE-3277 [1] and found that previous library serialize null strings as
>>> "" and null objects as "null", for example:
>>> {"a": "", "b": null}
>>>
>>> How about to serialize all values as "null" ?
>>> In this case we would definitely know that in Java before serialization
>>> to JSON was really NULL, not empty string.
>>>
>>> But this may break compatibility in some cases.
>>>
>>> Thoughts?
>>>
>>>
>>> 1. https://issues.apache.org/jira/browse/IGNITE-3277
>>>
>>> --
>>> Alexey Kuznetsov
>>> GridGain Systems
>>> www.gridgain.com
>>>
>>
>>
>


-- 
Alexey Kuznetsov
GridGain Systems
www.gridgain.com

Re: Change rest-http Java to JSON null transformation logic

Posted by Alexey Kuznetsov <ak...@gridgain.com>.
Pavel, in this case object will be serialized like : {"a": "null"} compare
with {"a": null}

On Thu, Jun 16, 2016 at 4:49 PM, Pavel Tupitsyn <pt...@gridgain.com>
wrote:

> Hi,
>
> What if there is an actual string with "null" value?
>
> Pavel.
>
> On Thu, Jun 16, 2016 at 12:44 PM, Vladislav Pyatkov <vpyatkov@gridgain.com
> > wrote:
>
>> Hello,
>>
>> Why do you want this, if you can save full compatibility using custom
>> serializer for null value (ObjectMapper#setSerializerProvider)?
>>
>> On Thu, Jun 16, 2016 at 12:15 PM, Alexey Kuznetsov <
>> akuznetsov@gridgain.com> wrote:
>>
>>> Hi All!
>>>
>>> I'm working on migrating from outdated json-lib to Jackson issue
>>> IGNITE-3277 [1] and found that previous library serialize null strings as
>>> "" and null objects as "null", for example:
>>> {"a": "", "b": null}
>>>
>>> How about to serialize all values as "null" ?
>>> In this case we would definitely know that in Java before serialization
>>> to JSON was really NULL, not empty string.
>>>
>>> But this may break compatibility in some cases.
>>>
>>> Thoughts?
>>>
>>>
>>> 1. https://issues.apache.org/jira/browse/IGNITE-3277
>>>
>>> --
>>> Alexey Kuznetsov
>>> GridGain Systems
>>> www.gridgain.com
>>>
>>
>>
>


-- 
Alexey Kuznetsov
GridGain Systems
www.gridgain.com

Re: Change rest-http Java to JSON null transformation logic

Posted by Pavel Tupitsyn <pt...@gridgain.com>.
Hi,

What if there is an actual string with "null" value?

Pavel.

On Thu, Jun 16, 2016 at 12:44 PM, Vladislav Pyatkov <vp...@gridgain.com>
wrote:

> Hello,
>
> Why do you want this, if you can save full compatibility using custom
> serializer for null value (ObjectMapper#setSerializerProvider)?
>
> On Thu, Jun 16, 2016 at 12:15 PM, Alexey Kuznetsov <
> akuznetsov@gridgain.com> wrote:
>
>> Hi All!
>>
>> I'm working on migrating from outdated json-lib to Jackson issue
>> IGNITE-3277 [1] and found that previous library serialize null strings as
>> "" and null objects as "null", for example:
>> {"a": "", "b": null}
>>
>> How about to serialize all values as "null" ?
>> In this case we would definitely know that in Java before serialization
>> to JSON was really NULL, not empty string.
>>
>> But this may break compatibility in some cases.
>>
>> Thoughts?
>>
>>
>> 1. https://issues.apache.org/jira/browse/IGNITE-3277
>>
>> --
>> Alexey Kuznetsov
>> GridGain Systems
>> www.gridgain.com
>>
>
>

Re: Change rest-http Java to JSON null transformation logic

Posted by Alexey Kuznetsov <ak...@gridgain.com>.
Vlad,

Actually I implemented 2 custom serializers: one for null strings and
another for null objects.
But I think that it looks like a "workaround" for me.

On Thu, Jun 16, 2016 at 4:44 PM, Vladislav Pyatkov <vp...@gridgain.com>
wrote:

> Hello,
>
> Why do you want this, if you can save full compatibility using custom
> serializer for null value (ObjectMapper#setSerializerProvider)?
>
> On Thu, Jun 16, 2016 at 12:15 PM, Alexey Kuznetsov <
> akuznetsov@gridgain.com> wrote:
>
>> Hi All!
>>
>> I'm working on migrating from outdated json-lib to Jackson issue
>> IGNITE-3277 [1] and found that previous library serialize null strings as
>> "" and null objects as "null", for example:
>> {"a": "", "b": null}
>>
>> How about to serialize all values as "null" ?
>> In this case we would definitely know that in Java before serialization
>> to JSON was really NULL, not empty string.
>>
>> But this may break compatibility in some cases.
>>
>> Thoughts?
>>
>>
>> 1. https://issues.apache.org/jira/browse/IGNITE-3277
>>
>> --
>> Alexey Kuznetsov
>> GridGain Systems
>> www.gridgain.com
>>
>
>


-- 
Alexey Kuznetsov
GridGain Systems
www.gridgain.com

Re: Change rest-http Java to JSON null transformation logic

Posted by Pavel Tupitsyn <pt...@gridgain.com>.
Hi,

What if there is an actual string with "null" value?

Pavel.

On Thu, Jun 16, 2016 at 12:44 PM, Vladislav Pyatkov <vp...@gridgain.com>
wrote:

> Hello,
>
> Why do you want this, if you can save full compatibility using custom
> serializer for null value (ObjectMapper#setSerializerProvider)?
>
> On Thu, Jun 16, 2016 at 12:15 PM, Alexey Kuznetsov <
> akuznetsov@gridgain.com> wrote:
>
>> Hi All!
>>
>> I'm working on migrating from outdated json-lib to Jackson issue
>> IGNITE-3277 [1] and found that previous library serialize null strings as
>> "" and null objects as "null", for example:
>> {"a": "", "b": null}
>>
>> How about to serialize all values as "null" ?
>> In this case we would definitely know that in Java before serialization
>> to JSON was really NULL, not empty string.
>>
>> But this may break compatibility in some cases.
>>
>> Thoughts?
>>
>>
>> 1. https://issues.apache.org/jira/browse/IGNITE-3277
>>
>> --
>> Alexey Kuznetsov
>> GridGain Systems
>> www.gridgain.com
>>
>
>

Re: Change rest-http Java to JSON null transformation logic

Posted by Vladislav Pyatkov <vp...@gridgain.com>.
Hello,

Why do you want this, if you can save full compatibility using custom
serializer for null value (ObjectMapper#setSerializerProvider)?

On Thu, Jun 16, 2016 at 12:15 PM, Alexey Kuznetsov <ak...@gridgain.com>
wrote:

> Hi All!
>
> I'm working on migrating from outdated json-lib to Jackson issue
> IGNITE-3277 [1] and found that previous library serialize null strings as
> "" and null objects as "null", for example:
> {"a": "", "b": null}
>
> How about to serialize all values as "null" ?
> In this case we would definitely know that in Java before serialization to
> JSON was really NULL, not empty string.
>
> But this may break compatibility in some cases.
>
> Thoughts?
>
>
> 1. https://issues.apache.org/jira/browse/IGNITE-3277
>
> --
> Alexey Kuznetsov
> GridGain Systems
> www.gridgain.com
>

Re: Change rest-http Java to JSON null transformation logic

Posted by Vladislav Pyatkov <vp...@gridgain.com>.
Hello,

Why do you want this, if you can save full compatibility using custom
serializer for null value (ObjectMapper#setSerializerProvider)?

On Thu, Jun 16, 2016 at 12:15 PM, Alexey Kuznetsov <ak...@gridgain.com>
wrote:

> Hi All!
>
> I'm working on migrating from outdated json-lib to Jackson issue
> IGNITE-3277 [1] and found that previous library serialize null strings as
> "" and null objects as "null", for example:
> {"a": "", "b": null}
>
> How about to serialize all values as "null" ?
> In this case we would definitely know that in Java before serialization to
> JSON was really NULL, not empty string.
>
> But this may break compatibility in some cases.
>
> Thoughts?
>
>
> 1. https://issues.apache.org/jira/browse/IGNITE-3277
>
> --
> Alexey Kuznetsov
> GridGain Systems
> www.gridgain.com
>

Re: Change rest-http Java to JSON null transformation logic

Posted by Alexey Kuznetsov <ak...@gridgain.com>.
Den, that was my main reason "consistency". Strings in java can be "null"
and can be empty. But after serialization we lost this info.
As for compatibility - I'm afraid it is impossible to fix. Only to change
user code.

On Thu, Jun 16, 2016 at 4:51 PM, Denis Magda <dm...@gridgain.com> wrote:

> This looks strange. Definitely for consistency reasons it makes sense that
> all ‘null’ objects including string are serialized as “null”.
>
> In regards to the compatibility stuff I think it can be resolved somehow.
>
> —
> Denis
>
> On Jun 16, 2016, at 12:15 PM, Alexey Kuznetsov <ak...@gridgain.com>
> wrote:
>
> Hi All!
>
> I'm working on migrating from outdated json-lib to Jackson issue
> IGNITE-3277 [1] and found that previous library serialize null strings as
> "" and null objects as "null", for example:
> {"a": "", "b": null}
>
> How about to serialize all values as "null" ?
> In this case we would definitely know that in Java before serialization to
> JSON was really NULL, not empty string.
>
> But this may break compatibility in some cases.
>
> Thoughts?
>
>
> 1. https://issues.apache.org/jira/browse/IGNITE-3277
>
> --
> Alexey Kuznetsov
> GridGain Systems
> www.gridgain.com
>
>
>


-- 
Alexey Kuznetsov
GridGain Systems
www.gridgain.com

Re: Change rest-http Java to JSON null transformation logic

Posted by Alexey Kuznetsov <ak...@gridgain.com>.
Den, that was my main reason "consistency". Strings in java can be "null"
and can be empty. But after serialization we lost this info.
As for compatibility - I'm afraid it is impossible to fix. Only to change
user code.

On Thu, Jun 16, 2016 at 4:51 PM, Denis Magda <dm...@gridgain.com> wrote:

> This looks strange. Definitely for consistency reasons it makes sense that
> all ‘null’ objects including string are serialized as “null”.
>
> In regards to the compatibility stuff I think it can be resolved somehow.
>
> —
> Denis
>
> On Jun 16, 2016, at 12:15 PM, Alexey Kuznetsov <ak...@gridgain.com>
> wrote:
>
> Hi All!
>
> I'm working on migrating from outdated json-lib to Jackson issue
> IGNITE-3277 [1] and found that previous library serialize null strings as
> "" and null objects as "null", for example:
> {"a": "", "b": null}
>
> How about to serialize all values as "null" ?
> In this case we would definitely know that in Java before serialization to
> JSON was really NULL, not empty string.
>
> But this may break compatibility in some cases.
>
> Thoughts?
>
>
> 1. https://issues.apache.org/jira/browse/IGNITE-3277
>
> --
> Alexey Kuznetsov
> GridGain Systems
> www.gridgain.com
>
>
>


-- 
Alexey Kuznetsov
GridGain Systems
www.gridgain.com

Re: Change rest-http Java to JSON null transformation logic

Posted by Pavel Tupitsyn <pt...@gridgain.com>.
Alexey, got it regarding "null" string, thank you.

Can you elaborate on non-null default values? Is it only for primitive
types, or something else?
Anyway, can we omit fields with default values? I have seen some
serializers that work this way.

Pavel.

On Thu, Jun 16, 2016 at 1:05 PM, Alexey Kuznetsov <ak...@gridgain.com>
wrote:

> Pavel, we cannot omit them.
>
> Because if JSON will be transformed back to Java and some java field has
> not null default value that will lead to not correct de-serialization in
> this case.
>
> On Thu, Jun 16, 2016 at 4:54 PM, Pavel Tupitsyn <pt...@gridgain.com>
> wrote:
>
>> Why do we even write null fields? Can we just omit them?
>> This will be faster, more compact, and less ambiguous.
>>
>> Pavel.
>>
>> On Thu, Jun 16, 2016 at 12:51 PM, Denis Magda <dm...@gridgain.com>
>> wrote:
>>
>>> This looks strange. Definitely for consistency reasons it makes sense
>>> that all ‘null’ objects including string are serialized as “null”.
>>>
>>> In regards to the compatibility stuff I think it can be resolved
>>> somehow.
>>>
>>> —
>>> Denis
>>>
>>> On Jun 16, 2016, at 12:15 PM, Alexey Kuznetsov <ak...@gridgain.com>
>>> wrote:
>>>
>>> Hi All!
>>>
>>> I'm working on migrating from outdated json-lib to Jackson issue
>>> IGNITE-3277 [1] and found that previous library serialize null strings as
>>> "" and null objects as "null", for example:
>>> {"a": "", "b": null}
>>>
>>> How about to serialize all values as "null" ?
>>> In this case we would definitely know that in Java before serialization
>>> to JSON was really NULL, not empty string.
>>>
>>> But this may break compatibility in some cases.
>>>
>>> Thoughts?
>>>
>>>
>>> 1. https://issues.apache.org/jira/browse/IGNITE-3277
>>>
>>> --
>>> Alexey Kuznetsov
>>> GridGain Systems
>>> www.gridgain.com
>>>
>>>
>>>
>>
>
>
> --
> Alexey Kuznetsov
> GridGain Systems
> www.gridgain.com
>

Re: Change rest-http Java to JSON null transformation logic

Posted by Pavel Tupitsyn <pt...@gridgain.com>.
Alexey, got it regarding "null" string, thank you.

Can you elaborate on non-null default values? Is it only for primitive
types, or something else?
Anyway, can we omit fields with default values? I have seen some
serializers that work this way.

Pavel.

On Thu, Jun 16, 2016 at 1:05 PM, Alexey Kuznetsov <ak...@gridgain.com>
wrote:

> Pavel, we cannot omit them.
>
> Because if JSON will be transformed back to Java and some java field has
> not null default value that will lead to not correct de-serialization in
> this case.
>
> On Thu, Jun 16, 2016 at 4:54 PM, Pavel Tupitsyn <pt...@gridgain.com>
> wrote:
>
>> Why do we even write null fields? Can we just omit them?
>> This will be faster, more compact, and less ambiguous.
>>
>> Pavel.
>>
>> On Thu, Jun 16, 2016 at 12:51 PM, Denis Magda <dm...@gridgain.com>
>> wrote:
>>
>>> This looks strange. Definitely for consistency reasons it makes sense
>>> that all ‘null’ objects including string are serialized as “null”.
>>>
>>> In regards to the compatibility stuff I think it can be resolved
>>> somehow.
>>>
>>> —
>>> Denis
>>>
>>> On Jun 16, 2016, at 12:15 PM, Alexey Kuznetsov <ak...@gridgain.com>
>>> wrote:
>>>
>>> Hi All!
>>>
>>> I'm working on migrating from outdated json-lib to Jackson issue
>>> IGNITE-3277 [1] and found that previous library serialize null strings as
>>> "" and null objects as "null", for example:
>>> {"a": "", "b": null}
>>>
>>> How about to serialize all values as "null" ?
>>> In this case we would definitely know that in Java before serialization
>>> to JSON was really NULL, not empty string.
>>>
>>> But this may break compatibility in some cases.
>>>
>>> Thoughts?
>>>
>>>
>>> 1. https://issues.apache.org/jira/browse/IGNITE-3277
>>>
>>> --
>>> Alexey Kuznetsov
>>> GridGain Systems
>>> www.gridgain.com
>>>
>>>
>>>
>>
>
>
> --
> Alexey Kuznetsov
> GridGain Systems
> www.gridgain.com
>

Re: Change rest-http Java to JSON null transformation logic

Posted by Alexey Kuznetsov <ak...@gridgain.com>.
Pavel, we cannot omit them.

Because if JSON will be transformed back to Java and some java field has
not null default value that will lead to not correct de-serialization in
this case.

On Thu, Jun 16, 2016 at 4:54 PM, Pavel Tupitsyn <pt...@gridgain.com>
wrote:

> Why do we even write null fields? Can we just omit them?
> This will be faster, more compact, and less ambiguous.
>
> Pavel.
>
> On Thu, Jun 16, 2016 at 12:51 PM, Denis Magda <dm...@gridgain.com> wrote:
>
>> This looks strange. Definitely for consistency reasons it makes sense
>> that all ‘null’ objects including string are serialized as “null”.
>>
>> In regards to the compatibility stuff I think it can be resolved somehow.
>>
>> —
>> Denis
>>
>> On Jun 16, 2016, at 12:15 PM, Alexey Kuznetsov <ak...@gridgain.com>
>> wrote:
>>
>> Hi All!
>>
>> I'm working on migrating from outdated json-lib to Jackson issue
>> IGNITE-3277 [1] and found that previous library serialize null strings as
>> "" and null objects as "null", for example:
>> {"a": "", "b": null}
>>
>> How about to serialize all values as "null" ?
>> In this case we would definitely know that in Java before serialization
>> to JSON was really NULL, not empty string.
>>
>> But this may break compatibility in some cases.
>>
>> Thoughts?
>>
>>
>> 1. https://issues.apache.org/jira/browse/IGNITE-3277
>>
>> --
>> Alexey Kuznetsov
>> GridGain Systems
>> www.gridgain.com
>>
>>
>>
>


-- 
Alexey Kuznetsov
GridGain Systems
www.gridgain.com

Re: Change rest-http Java to JSON null transformation logic

Posted by Alexey Kuznetsov <ak...@gridgain.com>.
Pavel, we cannot omit them.

Because if JSON will be transformed back to Java and some java field has
not null default value that will lead to not correct de-serialization in
this case.

On Thu, Jun 16, 2016 at 4:54 PM, Pavel Tupitsyn <pt...@gridgain.com>
wrote:

> Why do we even write null fields? Can we just omit them?
> This will be faster, more compact, and less ambiguous.
>
> Pavel.
>
> On Thu, Jun 16, 2016 at 12:51 PM, Denis Magda <dm...@gridgain.com> wrote:
>
>> This looks strange. Definitely for consistency reasons it makes sense
>> that all ‘null’ objects including string are serialized as “null”.
>>
>> In regards to the compatibility stuff I think it can be resolved somehow.
>>
>> —
>> Denis
>>
>> On Jun 16, 2016, at 12:15 PM, Alexey Kuznetsov <ak...@gridgain.com>
>> wrote:
>>
>> Hi All!
>>
>> I'm working on migrating from outdated json-lib to Jackson issue
>> IGNITE-3277 [1] and found that previous library serialize null strings as
>> "" and null objects as "null", for example:
>> {"a": "", "b": null}
>>
>> How about to serialize all values as "null" ?
>> In this case we would definitely know that in Java before serialization
>> to JSON was really NULL, not empty string.
>>
>> But this may break compatibility in some cases.
>>
>> Thoughts?
>>
>>
>> 1. https://issues.apache.org/jira/browse/IGNITE-3277
>>
>> --
>> Alexey Kuznetsov
>> GridGain Systems
>> www.gridgain.com
>>
>>
>>
>


-- 
Alexey Kuznetsov
GridGain Systems
www.gridgain.com

Re: Change rest-http Java to JSON null transformation logic

Posted by Pavel Tupitsyn <pt...@gridgain.com>.
Why do we even write null fields? Can we just omit them?
This will be faster, more compact, and less ambiguous.

Pavel.

On Thu, Jun 16, 2016 at 12:51 PM, Denis Magda <dm...@gridgain.com> wrote:

> This looks strange. Definitely for consistency reasons it makes sense that
> all ‘null’ objects including string are serialized as “null”.
>
> In regards to the compatibility stuff I think it can be resolved somehow.
>
> —
> Denis
>
> On Jun 16, 2016, at 12:15 PM, Alexey Kuznetsov <ak...@gridgain.com>
> wrote:
>
> Hi All!
>
> I'm working on migrating from outdated json-lib to Jackson issue
> IGNITE-3277 [1] and found that previous library serialize null strings as
> "" and null objects as "null", for example:
> {"a": "", "b": null}
>
> How about to serialize all values as "null" ?
> In this case we would definitely know that in Java before serialization to
> JSON was really NULL, not empty string.
>
> But this may break compatibility in some cases.
>
> Thoughts?
>
>
> 1. https://issues.apache.org/jira/browse/IGNITE-3277
>
> --
> Alexey Kuznetsov
> GridGain Systems
> www.gridgain.com
>
>
>

Re: Change rest-http Java to JSON null transformation logic

Posted by Pavel Tupitsyn <pt...@gridgain.com>.
Why do we even write null fields? Can we just omit them?
This will be faster, more compact, and less ambiguous.

Pavel.

On Thu, Jun 16, 2016 at 12:51 PM, Denis Magda <dm...@gridgain.com> wrote:

> This looks strange. Definitely for consistency reasons it makes sense that
> all ‘null’ objects including string are serialized as “null”.
>
> In regards to the compatibility stuff I think it can be resolved somehow.
>
> —
> Denis
>
> On Jun 16, 2016, at 12:15 PM, Alexey Kuznetsov <ak...@gridgain.com>
> wrote:
>
> Hi All!
>
> I'm working on migrating from outdated json-lib to Jackson issue
> IGNITE-3277 [1] and found that previous library serialize null strings as
> "" and null objects as "null", for example:
> {"a": "", "b": null}
>
> How about to serialize all values as "null" ?
> In this case we would definitely know that in Java before serialization to
> JSON was really NULL, not empty string.
>
> But this may break compatibility in some cases.
>
> Thoughts?
>
>
> 1. https://issues.apache.org/jira/browse/IGNITE-3277
>
> --
> Alexey Kuznetsov
> GridGain Systems
> www.gridgain.com
>
>
>

Re: Change rest-http Java to JSON null transformation logic

Posted by Denis Magda <dm...@gridgain.com>.
This looks strange. Definitely for consistency reasons it makes sense that all ‘null’ objects including string are serialized as “null”.

In regards to the compatibility stuff I think it can be resolved somehow. 

—
Denis

> On Jun 16, 2016, at 12:15 PM, Alexey Kuznetsov <ak...@gridgain.com> wrote:
> 
> Hi All!
> 
> I'm working on migrating from outdated json-lib to Jackson issue IGNITE-3277 [1] and found that previous library serialize null strings as "" and null objects as "null", for example:
> {"a": "", "b": null}
> 
> How about to serialize all values as "null" ?
> In this case we would definitely know that in Java before serialization to JSON was really NULL, not empty string.
> 
> But this may break compatibility in some cases.
> 
> Thoughts?
> 
> 
> 1. https://issues.apache.org/jira/browse/IGNITE-3277 <https://issues.apache.org/jira/browse/IGNITE-3277>
> 
> -- 
> Alexey Kuznetsov
> GridGain Systems
> www.gridgain.com <http://www.gridgain.com/>


Re: Change rest-http Java to JSON null transformation logic

Posted by Denis Magda <dm...@gridgain.com>.
This looks strange. Definitely for consistency reasons it makes sense that all ‘null’ objects including string are serialized as “null”.

In regards to the compatibility stuff I think it can be resolved somehow. 

—
Denis

> On Jun 16, 2016, at 12:15 PM, Alexey Kuznetsov <ak...@gridgain.com> wrote:
> 
> Hi All!
> 
> I'm working on migrating from outdated json-lib to Jackson issue IGNITE-3277 [1] and found that previous library serialize null strings as "" and null objects as "null", for example:
> {"a": "", "b": null}
> 
> How about to serialize all values as "null" ?
> In this case we would definitely know that in Java before serialization to JSON was really NULL, not empty string.
> 
> But this may break compatibility in some cases.
> 
> Thoughts?
> 
> 
> 1. https://issues.apache.org/jira/browse/IGNITE-3277 <https://issues.apache.org/jira/browse/IGNITE-3277>
> 
> -- 
> Alexey Kuznetsov
> GridGain Systems
> www.gridgain.com <http://www.gridgain.com/>