You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
rascal>data Foo = foo(int a=-1);
ok
rascal>parseJSON(#Foo, "{\"a\": 2}");
Foo: foo(a=2)
rascal>parseJSON(#Foo, "{\"a\": null}");
|std:///lang/json/IO.rsc|(2599,303,<49,0>,<52,144>): Java("IllegalStateException","Expected a name but was NULL at line 1 column 11 path $.a")
at com.google.gson.stream.JsonReader.nextName(|unknown:///JsonReader.java|(0,0,<800,0>,<800,0>))
at org.rascalmpl.library.lang.json.internal.JsonValueReader$2.visitAbstractData(|unknown:///JsonValueReader.java|(0,0,<517,0>,<517,0>))
at org.rascalmpl.library.lang.json.internal.JsonValueReader$2.visitAbstractData(|unknown:///JsonValueReader.java|(0,0,<116,0>,<116,0>))
at io.usethesource.vallang.type.AbstractDataType.accept(|unknown:///AbstractDataType.java|(0,0,<422,0>,<422,0>))
at org.rascalmpl.library.lang.json.internal.JsonValueReader.read(|unknown:///JsonValueReader.java|(0,0,<116,0>,<116,0>))
at org.rascalmpl.library.lang.json.IO.parseJSON(|unknown:///IO.java|(0,0,<130,0>,<130,0>))
at parseJSON(|std:///lang/json/IO.rsc|(2895,5,<52,137>,<52,142>)ok
The text was updated successfully, but these errors were encountered:
Apparently,
null
fields in JSON are ignored (or trigger exceptions):With an explicit type, it triggers an exception:
The text was updated successfully, but these errors were encountered: