Renaming an object key
Currently, it is not possible to rename an object key efficiently. However, renaming an object key can be handy at times.
For example, I am currently implementing a Json-RPC library. The library also provides a server class which processes Json-RPC requests (a JsonVariant
) and calls appropriate callback methods which in turn fill a Json-RPC response (also a JsonVariant
). Depending on the success of the callback, either the "result"
member or the "error"
member must be filled according to the specification. If renaming object keys would be possible with ArduinoJson, the callbacks could just care about filling a JsonVariant
with a result or an error object and the server would take care of choosing the right key name depending on the callback's success. Currently, the callbacks need to be aware of the Json-RPC specification which I consider a rather clumsy style.
This is just my use case of renaming object keys but I am sure other people would also benefit from this feature.
BTW Thank you so much for this awesome library! :-)
Yann