Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support jsonpointer format as rfc6901 #71

Open
gcp85163 opened this issue May 24, 2023 · 3 comments
Open

support jsonpointer format as rfc6901 #71

gcp85163 opened this issue May 24, 2023 · 3 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@gcp85163
Copy link

Hi,
Does sonic-cpp support merge-patch easily?
For example : { op: replace, patch : "Object/0/New_object", value : "123" }

If use json_pointer:
sonic_json::Node* node2 = doc.AtPointer(PointerType({"Object", 0, "New_object"}));
This doesn't format well. transfer patch : "Object/0/New_object" to {"Object", 0, "New_object"}

@liuq19
Copy link
Collaborator

liuq19 commented May 24, 2023

Are you discuss about jsonpointer rfc, for example, "/Object/0/New_object" follows jsonpointer rfc.

We will support the RFC in the future.

However, parsing “Object/0/New_object” hurts performance, and it can be easily rewritten as {"Object", 0, "New_object"}, so, we suggest using the existing format like {"Object", 0, "New_object"}.

@liuq19 liuq19 added the good first issue Good for newcomers label May 24, 2023
@gcp85163
Copy link
Author

gcp85163 commented May 24, 2023

Are you discuss about jsonpointer rfc, for example, "/Object/0/New_object" follows jsonpointer rfc.

We will support the RFC in the future.

However, parsing “Object/0/New_object” hurts performance, and it can be easily rewritten as {"Object", 0, "New_object"}, so, we suggest using the existing format like {"Object", 0, "New_object"}.

Yes, I am talking about jsonpointer rfc.

For current code, How to rewritten as {"Object", 0, "New_object"}? just split string by '/' ? But how to handle string to int automatic?
Can you give me some example?

@liuq19
Copy link
Collaborator

liuq19 commented May 25, 2023

This is not just a matter of splitting strings by '/', you need to refer to the RFC to distinguish the escape characters. and you can refer to the rapidjson.

@liuq19 liuq19 added the help wanted Extra attention is needed label May 25, 2023
@liuq19 liuq19 changed the title Does it support json merge patch. support jsonpointer format as rfc6901 May 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants