Skip to content

fixed load_json#1

Merged
vikulin merged 2 commits intovikulin:masterfrom
AlahmadiQ8:master
Jul 20, 2016
Merged

fixed load_json#1
vikulin merged 2 commits intovikulin:masterfrom
AlahmadiQ8:master

Conversation

@AlahmadiQ8
Copy link

“Set Json Value” Keyword always fails when supplied a string that is not “true” or “false” because json.dumps() in load_json cannot encode str to json.

if json.dumps() loads an error, then just return json_string.

Test Case

Set Json Value     {}    /testing   true  # always worked since json.dumps(‘true’) is valid 
Set Json Value   {}   /testing2   some_str   # was failing because json.dumps(‘some_str’) throws an error

@vikulin
Copy link
Owner

vikulin commented Jul 20, 2016

This method will be broken if I apply your change:
`
def parse_json(self, json_string):

    """

    Parses the JSON document `json_string` and returns a data structure.

    Example:

    | ${result}=       | Parse Json  | [1, 2, 3] |

    | Length Should Be | ${result}   | 3         |

    `json_string` is the string containg JSON that will be parsed

    """

return load_json(json_string)`

Please rewrite your change specifically for this method:

def set_json_value(self, json_string, json_pointer, json_value):

@AlahmadiQ8
Copy link
Author

@vikulin done. please check my last commit 67f1b2b

@vikulin vikulin merged commit 5b6537c into vikulin:master Jul 20, 2016
vikulin pushed a commit that referenced this pull request Jul 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants