Based on the JSONPath Internet Draft, I recently wrote a CBORPath implementation in Rust: https://github.com/dahomey-technologies/cborpath-rs.
The main difference between JSONPath and my CBORPath proposal is that CBORPath is itself represented as a valid CBOR expression.
Pros:
- Any valid
CBOR value, including a byte string can be expressed in a CBORPath expression.
- A
CBOR map key can be any valid CBOR value, not only text like JSON object names. Consequently, the JSONPath name-selector is replaced by a CBORPath key-selector.
- An existing
CBOR parser or deserializer is enough to validate a CBORPath expression, no need to write neither a grammar nor a parser.
Cons:
- A
CBORPath expression is more verbose than the JSONPath equivalent
Thank you to give your thoughts about the proposal. I may take the time to write an Internet draft.
Michaël
PS: reddit post link
Based on the JSONPath Internet Draft, I recently wrote a
CBORPathimplementation in Rust: https://github.com/dahomey-technologies/cborpath-rs.The main difference between
JSONPathand myCBORPathproposal is that CBORPath is itself represented as a valid CBOR expression.Pros:
CBORvalue, including a byte string can be expressed in aCBORPathexpression.CBORmap key can be any validCBORvalue, not only text likeJSONobject names. Consequently, theJSONPathname-selector is replaced by aCBORPathkey-selector.CBORparser or deserializer is enough to validate aCBORPathexpression, no need to write neither a grammar nor a parser.Cons:
CBORPathexpression is more verbose than theJSONPathequivalentThank you to give your thoughts about the proposal. I may take the time to write an Internet draft.
Michaël
PS: reddit post link