CollectionJson.Net icon indicating copy to clipboard operation
CollectionJson.Net copied to clipboard

Data.Value isn't an object?

Open harboe opened this issue 9 years ago • 2 comments

Hi,

Shouldn't the Data.Value be an object, currently it's a string. In order to properly assign; int, arrays, bool, etc. you have to use the SetValue("value", true) to enforce the correct serialization. Wouldn't it be easier it the Data.Value just was an object? or I'm missing something?

Best regards

Dennis

harboe avatar Aug 03 '16 07:08 harboe

It make sense that it should be object, but the value would have to be type checked to ensure it matches the spec. Array does not appear to be a supported value type yet.

7.6. VALUE
A VALUE data type MUST be a NUMBER, STRING, or one of the following literal names: false, null, or true.

NOTE: This release of Collection+JSON does not support OBJECT or ARRAY as a valid VALUE.

@mamund is that correct?

glennblock avatar Aug 04 '16 08:08 glennblock

in this release of Cj, data.value is not an object. You can, however, extend Cj by adding an object property (data.object). there may already be some Cj extensions that do this, too.

check out the cj extensions list and, if you don't see what you think you need, feel free to start a new extension and, as long as it is backward compatible, we can register it for others to use, too.

mamund avatar Aug 04 '16 15:08 mamund