Its a well known issue when communicating complex structures between client and server, using the JSON encoding.
I’ve encountered it when attempting to transfer an encrypted Byte Array back and forth between a client and server, that communicate via JSON.
What doesn’t work:
Base64 encodings and conversions to string formats
What does work:
Converting the Byte[] to a number array and back
Here is an example code in Flex (works just as well in Java / PHP / Python etc)
original post from giladmanor.com