Hi,
Please, how should I modify the mapping to be able to parse the following
example?
-=-=-=-
rectangleJson := '{
"origin" : null,
"corner" : null
}'.
(NeoJSONReader on: rectangleJson readStream)
mapInstVarsFor: Point;
for: Rectangle do: [ :mapping |
(mapping mapInstVar: #origin) valueSchema: Point.
(mapping mapInstVar: #corner) valueSchema: Point ];
nextAs: Rectangle.
-=-=-=-
I receive from a server JSON messages including null values.
Can we say use Point value schema or null? How?
In the documentation I can see the example:
-=-=-=-
String streamContents: [ :stream |
(NeoJSONWriter on: stream)
mapAllInstVarsFor: Point;
writeNil: true;
nextPut: Point new ].
-=-=-=-
that produces {"x":null,"y":null}
But I do not see how to apply this for the following example:
-=-=-=-
String streamContents: [ :stream |
(NeoJSONWriter on: stream)
mapAllInstVarsFor: Point;
for: Rectangle do: [ :mapping |
(mapping mapInstVar: #origin) valueSchema: Point.
(mapping mapInstVar: #corner) valueSchema: Point ];
writeNil: true;
nextPut: Rectangle new ].
-=-=-=-
Thanks,
Juraj