mouse07410 / asn1c

The ASN.1 Compiler
http://lionet.info/asn1c/
BSD 2-Clause "Simplified" License
93 stars 70 forks source link

jer: Unwrapped root #151

Closed v0-e closed 8 months ago

v0-e commented 8 months ago

Currently the JER encoding of any definition adds a wrapper object to it. This is not inline with X.697 (see encoded JSON examples in the standard, or check Nokalva's playground). This PR removes this wrapper.

For example, consider the definitions:

The old/new behaviours are, (I've here removed the whitespaces still added by the encoder): Old behaviour encoding:

New behaviour encoding:

While this new encoding is arguably worse from a user/application standpoint since it does not provide the name of the definition in the encoded JSON, it should increase interoperability with other JER encoders/decoders. This change also enables a more natural decoder implementation.

This PR also includes the support for JSON-compliant escapes in strings, and also enables randomized tests for JER. I've chosen to include both of these features here because they depend on the new changes to the encoder/decoder.