It's Moodle 2.4.
I've made some progress with the problem - it actually required one more level of arrays, like this:
array(
'courseid' => 10,
'grades' => array(
array(
array(
'grade' => 50.0,
'userid' => 20
),
),
array(
array(
'grade' => 50.0,
'userid' => 19
),
),
)
)
Don't ask my why, because I don't know - it's just a random thing I tried out of desperation and it got me a bit further.
Now I'm stuck with:
grades => Invalid parameter value detected: Only arrays accepted. The bad value is: '{'grade': 50, 'userid': 20}'.
I know it looks like json, but I'm not POSTin json, but a Python dictionary (rough equivalent of PHP associative array).
Is there a way I could json_decode before validation? I could just send json and skip the whole format issue..