Fix the way we cast string which contains an array.
Fix the way we cast string which contains an array.

String can be either serialized as JSON or as raw Python object so we need to
use the same serializattion method we use for objects (dicts).

Also get rid of lambda for readability and use six.string_types so it also works
under Python 3.

punalpatel/st2,StackStorm/st2,armab/st2,dennybaa/st2,pinterb/st2,tonybaloney/st2,nzlosh/st2,alfasin/st2,peak6/st2,lakshmi-kannan/st2,alfasin/st2,Plexxi/st2,StackStorm/st2,lakshmi-kannan/st2,nzlosh/st2,peak6/st2,pinterb/st2,StackStorm/st2,Plexxi/st2,jtopjian/st2,Itxaka/st2,punalpatel/st2,StackStorm/st2,Plexxi/st2,emedvedev/st2,lakshmi-kannan/st2,pinterb/st2,pixelrebel/st2,armab/st2,Plexxi/st2,jtopjian/st2,grengojbo/st2,nzlosh/st2,grengojbo/st2,dennybaa/st2,nzlosh/st2,alfasin/st2,Itxaka/st2,armab/st2,peak6/st2,emedvedev/st2,tonybaloney/st2,jtopjian/st2,pixelrebel/st2,pixelrebel/st2,tonybaloney/st2,grengojbo/st2,punalpatel/st2,emedvedev/st2,dennybaa/st2,Itxaka/st2