{
"A": {
"B": [
{
"C00": 0,
"D00": "test00"
},
{
"C01": 0,
"D01": "test01"
}
]
}
}${json} = Get Response Body
&{data} = Parse Json ${json}
Log to console ${data['A']['B'][0]['C00']}
${data['A']['B'][0]['C00']} = Evaluate 1
Log to console ${data['A']['B'][0]['C00']} # C00 = 1
Log to console ${data} # C00 = 0
Set to Dictionary ${data} ${data['A']['B'][0]['C00']} 1
Log to console ${data['A']['B'][0]['C00']} # C00 = 0
Log to console ${data} {
"A": {
"B": [
{
"C00": 0,
"D00": "test00"
},
{
"C01": 0,
"D01": "test01"
}
]
},
1: 1
}Hello,
I think you should be able to use something like
Set To Dictionary ${data['A']['B'][0]} C00 1
Notice that when you use
${data['A']['B'][0]['C00']} = Evaluate 1
what you actually get is variable with name
${data['A']['B'][0]['C00']}. The only assignment syntax that is
supported in addition to the normal
${name} = Keyword args
is
${name.attribute} = Keyword args
Adding support for what you used would be possible, but perhaps a bit
risky considering backwards compatibility. It would be safer to
support
${data}[A]'B][0][C00] = Keyword args
similarly as https://github.com/robotframework/robotframework/issues/2601
proposes.
In general working with (nested) dicts and lists should be made easier
in Robot. This can include syntax changes and also enhancements to
BuiltIn and Collections libraries. Enhancement ideas and general
comments about the matter are appreciated!
Cheers,
.peke
> ----
> You received this message because you are subscribed to the Google Groups
> "robotframework-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to robotframework-users+unsub...@googlegroups.com.
> To post to this group, send email to robotframework-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/robotframework-users.
> For more options, visit https://groups.google.com/d/optout.
Agile Tester/Developer/Consultant :: http://eliga.fi
Lead Developer of Robot Framework :: http://robotframework.org