JSON补丁RFC中的代字转码应该如何运作? [英] How is the tilde escaping in the JSON Patch RFC supposed to operate?
问题描述
引用 http://tools.ietf.org/html/rfc6902#appendix -A.14 :
A.14. 〜转义命令
A.14. ~ Escape Ordering
目标JSON文档示例:
An example target JSON document:
{
"/": 9,
"~1": 10
}
JSON补丁文件:
[
{"op": "test", "path": "/~01", "value": 10}
]
生成的JSON文档:
{
"/": 9,
"~1": 10
}
我正在写此RFC的实现,对此我一无所获.这是想达到什么目的,以及它应该如何工作?
I'm writing an implementation of this RFC, and I'm stuck on this. What is this trying to achieve, and how is it supposed to work?
假设第一部分的答案是允许包含/s的json键名被引用",您将如何做?
Assuming the answer to the first part is "Allowing json key names containing /s to be referenced," how would you do that?
推荐答案
我认为RFC中提供的示例并非经过深思熟虑,尤其是它仅尝试通过示例来记录功能,这充其量是模糊的-不提供任何评论.
I think the example provided in RFC isn't exactly best thought-out, especially that it tries to document a feature only through example, which is vague at best - without providing any kind of commentary.
您可能对以下文档中提供的解释感兴趣:
You might be interested in interpretation presented in following documents:
- Documentation of Rackspace API
- Documentation of OpenStack API
这些看起来非常相似,我认为这是由于Rackspace与OpenStack之间关系的性质所致:
These seem awfully similar and I think it's due to nature of relation between Rackspace and OpenStack:
OpenStack于2010年作为Rackspace Hosting和NASA(...)的联合项目而开始.
OpenStack began in 2010 as a joint project of Rackspace Hosting and NASA (...)
与RFC本身相反,它实际上提供了一些有用的细节,包括它接受的语法和引入这些标记的原理.
It actually provides some useful details including grammar it accepts and rationale behind introducing these tokens, as opposed to the RFC itself.
JSON指针似乎具有单独的RFC 6901,可在此处获得,并且上面的OpenStack和Rackspace规范与此一致.
it seems that JSON pointers have separate RFC 6901, which is available here and OpenStack and Rackspace specifications above are consistent with it.
这篇关于JSON补丁RFC中的代字转码应该如何运作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!