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

can we use jsonpath for setting a value #84

Closed
xycloud opened this issue Dec 20, 2017 · 3 comments
Closed

can we use jsonpath for setting a value #84

xycloud opened this issue Dec 20, 2017 · 3 comments
Labels

Comments

@xycloud
Copy link

xycloud commented Dec 20, 2017

AFAIK, we always use jsonpath for getting value from a json object, is that possible to set a value by jsonpath?

@brettz9
Copy link
Collaborator

brettz9 commented Oct 19, 2018

Yes, the objects returned are not copies... However, as with all JavaScript objects, if you are modifying a scalar value within an object (i.e., not an array or object), you will need the parent object and the property name to modify.

You can use resultType: 'all' with JSONPath Plus, to get the parent and parentProperty to reference the parent object and property you wish to modify.

Closing as that should answer the question, but feel free to comment further as needed.

@brettz9 brettz9 closed this as completed Oct 19, 2018
@xblurx
Copy link

xblurx commented Nov 10, 2023

hi there, just found this question and wanted to ask what is the actual api for setting the object value at path with JSONPath ?

@xblurx
Copy link

xblurx commented Nov 10, 2023

no need to answer as I found the answer in #126

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants