Skip to content

Release 0.4 #40

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

Merged
merged 2 commits into from
May 23, 2022
Merged
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions JSONLibrary/JSONLibraryKeywords.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,20 +179,21 @@ def convert_string_to_json(self, json_string):
return json.loads(json_string)

@keyword("Dump JSON To File")
def dump_json_to_file(self, dest_file, json_object):
def dump_json_to_file(self, dest_file, json_object, encoding=None):
"""Dump JSON to file

Arguments:
- dest_file: destination file
- json_object: json as a dictionary object.
- encoding: encoding of the file

Export the JSON object to a file

Examples:
| Dump JSON To File | ${OUTPUTID)${/}output.json | ${json} |
"""
json_str = self.convert_json_to_string(json_object)
with open(dest_file, "w") as json_file:
with open(dest_file, "w",encoding=encoding) as json_file:
json_file.write(json_str)
return str(dest_file)

Expand Down
2 changes: 1 addition & 1 deletion JSONLibrary/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

VERSION = "0.3.1"
VERSION = "0.4"
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ JSONPath is an expression which can help to access to your JSON document. The JS

This library can help you to add, get, update and delete your JSON object. So it's very useful in case that you have a very large JSON object.

Please note this library is a bridge between the Robot Framework and the parser jsonpath-ng. Hence, issues related to parsing should be raised on https://github.com/h2non/jsonpath-ng

# Usage
Install robotframework-jsonlibrary via ``pip`` command
```bash
Expand Down Expand Up @@ -51,6 +53,14 @@ For an example of JSONPath expressions. Go to this link:

https://goessner.net/articles/JsonPath/index.html#e3

Parser: jsonpath-ng:

https://github.com/h2non/jsonpath-ng

This github:

https://github.com/robotframework-thailand/robotframework-jsonlibrary

#Help & Issues
Mention me on Twitter [@nottyo](https://twitter.com/nottyo)

Expand Down
Loading