Raw (de)serialization using `@JsonRawValue`
janhicken opened this issue · comments
Jan Hicken commented
Jackson features an annotation named @JsonRawValue
:
@JsonRawValue
: per-property marker that can be used to specify that the value of property is to be included in serialization ''exactly'' as is, with no escaping or decoration -- useful for embedding pre-serialized JSON (or whatever data format is being used) in output
It would be handy to also have this in emfjson, both for serialization as well as deserialization, where the latter is currently not supported by Jackson's annotation.
An example Xcore:
class Foo {
@JsonRawValue(value="true")
String raw
}
The following JSON object and EObject
should be equivalent:
{
"eClass": "http://foo/model#//Foo",
"raw": {
"foo": "bar"
}
}
var foo = ModelFactory.eINSTANCE.createFoo();
foo.setRaw("{\"foo\":\"bar\"}")