From be32bb3369be59670f54ad756f9ee6d27d77f32c Mon Sep 17 00:00:00 2001 From: Laurent PINSON Date: Mon, 23 May 2022 10:14:39 +0200 Subject: [PATCH 1/2] Release 0.4 --- JSONLibrary/JSONLibraryKeywords.py | 4 +- JSONLibrary/version.py | 2 +- README.md | 10 + docs/JSONLibrary.html | 1573 ++++++++++++++++++++++------ generate.py | 3 +- 5 files changed, 1263 insertions(+), 329 deletions(-) diff --git a/JSONLibrary/JSONLibraryKeywords.py b/JSONLibrary/JSONLibraryKeywords.py index f65c44d..84737ca 100644 --- a/JSONLibrary/JSONLibraryKeywords.py +++ b/JSONLibrary/JSONLibraryKeywords.py @@ -179,7 +179,7 @@ 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: @@ -192,7 +192,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 @@ - + + - + + @@ -557,7 +1202,7 @@

Opening library documentation failed

@@ -565,24 +1210,57 @@

Opening library documentation failed

- + + + + + + + + + diff --git a/generate.py b/generate.py index 055c9f0..09d348e 100644 --- a/generate.py +++ b/generate.py @@ -1,10 +1,11 @@ #!/usr/bin/env python +from __future__ import print_function from os.path import join, dirname try: from robot.libdoc import libdoc except: def main(): - print """Robot Framework 2.7 or later required for generating documentation""" + print("Robot Framework 2.7 or later required for generating documentation") else: def main(): libdoc(join(dirname(__file__),'JSONLibrary'), From 10a62be3aa199014eef7a76c5439900581ffc8d2 Mon Sep 17 00:00:00 2001 From: Laurent PINSON Date: Mon, 23 May 2022 10:20:15 +0200 Subject: [PATCH 2/2] doc... --- JSONLibrary/JSONLibraryKeywords.py | 1 + 1 file changed, 1 insertion(+) diff --git a/JSONLibrary/JSONLibraryKeywords.py b/JSONLibrary/JSONLibraryKeywords.py index 84737ca..222ae9a 100644 --- a/JSONLibrary/JSONLibraryKeywords.py +++ b/JSONLibrary/JSONLibraryKeywords.py @@ -185,6 +185,7 @@ def dump_json_to_file(self, dest_file, json_object, encoding=None): Arguments: - dest_file: destination file - json_object: json as a dictionary object. + - encoding: encoding of the file Export the JSON object to a file