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

Added function remove_json_key #58

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/HttpLibrary/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,16 @@ def log_json(self, json_string, log_level='INFO'):
for line in json.dumps(json_string, indent=2, ensure_ascii=False).split('\n'):
logger.write(line, log_level)

# debug
@_with_json
def remove_json_key(self, json_string, json_pointer):
"""
Remove the target key of the JSON document `json_string` specified by
JSON Pointer `json_pointer` to `json_value`.

Example:
| ${result}= | Remove Json Key | {"foo": {"bar": [1,2,3]}} | /foo/bar |
"""
return jsonpatch.apply_patch(json_string, [{'op': 'remove','path': json_pointer}])

def show_response_body_in_browser(self):
"""
Expand Down