Script transform giving ScriptEval errors with seemingly valid dictionary manipulation

I have data from a Query Binding being sent as JSON to a script transform and the data looks like this:

[ { 'source': 'beginning:end', 'count': 5}, 
  { 'source': 'beginning2:end2', 'count': 10}]

My goal is to get it to look like this:

[ { 'source': 'end', 'count': 5}, 
  { 'source': 'end2', 'count': 10}]

And I’m using the following script transform code within the transform function to try to accomplish this:

for x in value:
	x['source'] = x['source'].split(':')[-1]

return value

I’ve tested this in the Scripting Console, in online REPLs and this code does exactly what I want. However, I always get Error_ScriptEval in the Binding Preview when trying to actually use this code as a script transform.

I’m stumped, any ideas as to what is going wrong here?

You can’t modify the value passed in.

	newValues = []
	for x in value:
		newValue = {}
		for k, v in x.iteritems():
			if k == "source":
				newValue[k] = v.split(':')[-1]
				newValue[k] = v
	return newValues

Well that explains it, and fixed the problem. Thank you!