diff --git a/JSONLibrary/JSONLibraryKeywords.py b/JSONLibrary/JSONLibraryKeywords.py index f65c44d..222ae9a 100644 --- a/JSONLibrary/JSONLibraryKeywords.py +++ b/JSONLibrary/JSONLibraryKeywords.py @@ -179,12 +179,13 @@ 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 @@ -192,7 +193,7 @@ def dump_json_to_file(self, dest_file, json_object): | 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) diff --git a/JSONLibrary/version.py b/JSONLibrary/version.py index 5686463..313203e 100644 --- a/JSONLibrary/version.py +++ b/JSONLibrary/version.py @@ -1,4 +1,4 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -VERSION = "0.3.1" +VERSION = "0.4" diff --git a/README.md b/README.md index 7e10671..a97550e 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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) diff --git a/docs/JSONLibrary.html b/docs/JSONLibrary.html index 340fece..d98f841 100644 --- a/docs/JSONLibrary.html +++ b/docs/JSONLibrary.html @@ -1,86 +1,566 @@ - +
+ - + +