jsonutils: add customization for toJson via ToJsonOptions; generalize symbolName; add symbolRank
#18029
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
jsonutils: add customization for toJson via ToJsonOptions, right now it only allows customizing how to serialize enum's; this could be extend in future to allow other reasonable customizations, eg for serializing
charas string instead of intgeneralize symbolName to allow HoleyEnum; it's used by jsonutils to allow rendering enums via symbol name, arguable a better choice than using the
$(which suffers from sandwich problem, need for synchronization between serializer and deserializer, duplicate name issue and less stable). The default for serializing enums in jsonutils stays the same for reasons previously discussed.add symbolRank which is useful in itself and also used by
symbolNamefuture work
$to serialize/deserialize enums, for same reasons as mentioned above (refsjson.%should serialize enum as number (ord), not string #17996)