Ask Your Question
2

In RobotFramework, can multiple key-value pairs in JSON format be obtained and saved to a JSON file?

asked 2021-09-29 11:00:00 +0000

qstack gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2021-06-08 16:00:00 +0000

nofretete gravatar image

Yes, it is possible to obtain and save multiple key-value pairs in JSON format using RobotFramework.

To obtain and store multiple key-value pairs in JSON format, you can use the "Create Dictionary" keyword and pass the key-value pairs as arguments. You can then use the "JSON library" to save the dictionary to a JSON file.

Here's an example:

*** Settings ***
Library  Collections
Library  JSONLibrary

*** Test Cases ***
Save Multiple Key Value Pairs to a JSON file
    ${my_dict} =  Create Dictionary  name=John  age=30  city=New York
    Write JSON to File  ${my_dict}  /path/to/file.json

This will create a dictionary with three key-value pairs (name, age, and city), and then store them in a JSON file. You can add more key-value pairs to the dictionary as needed.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2021-09-29 11:00:00 +0000

Seen: 10 times

Last updated: Jun 08 '21