Skip to content

Commit ab23d54

Browse files
authored
Merge pull request #40 from elrandira/master
Release 0.4
2 parents 7335437 + 10a62be commit ab23d54

File tree

5 files changed

+1264
-329
lines changed

5 files changed

+1264
-329
lines changed

JSONLibrary/JSONLibraryKeywords.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,20 +179,21 @@ def convert_string_to_json(self, json_string):
179179
return json.loads(json_string)
180180

181181
@keyword("Dump JSON To File")
182-
def dump_json_to_file(self, dest_file, json_object):
182+
def dump_json_to_file(self, dest_file, json_object, encoding=None):
183183
"""Dump JSON to file
184184
185185
Arguments:
186186
- dest_file: destination file
187187
- json_object: json as a dictionary object.
188+
- encoding: encoding of the file
188189
189190
Export the JSON object to a file
190191
191192
Examples:
192193
| Dump JSON To File | ${OUTPUTID)${/}output.json | ${json} |
193194
"""
194195
json_str = self.convert_json_to_string(json_object)
195-
with open(dest_file, "w") as json_file:
196+
with open(dest_file, "w",encoding=encoding) as json_file:
196197
json_file.write(json_str)
197198
return str(dest_file)
198199

JSONLibrary/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33

4-
VERSION = "0.3.1"
4+
VERSION = "0.4"

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ JSONPath is an expression which can help to access to your JSON document. The JS
1818

1919
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.
2020

21+
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
22+
2123
# Usage
2224
Install robotframework-jsonlibrary via ``pip`` command
2325
```bash
@@ -51,6 +53,14 @@ For an example of JSONPath expressions. Go to this link:
5153

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

56+
Parser: jsonpath-ng:
57+
58+
https://github.com/h2non/jsonpath-ng
59+
60+
This github:
61+
62+
https://github.com/robotframework-thailand/robotframework-jsonlibrary
63+
5464
#Help & Issues
5565
Mention me on Twitter [@nottyo](https://twitter.com/nottyo)
5666

0 commit comments

Comments
 (0)