I set the a array as an environment variable in this manner
eg. script test.sh
in test.sh
#!/bin/bash
export STRING=( \"str1\" \"str2\"
The misunderstanding is in thinking that environment variables are only used by shells - they are not. No attributes, including readonly, integer, and arrays, can be exported into the environment block. Environment variables may be read by any language, C, C++, Perl, Java, Python, PHP, and so on. They also exist on Windows.
So, how could another language support Bash specific attributes? All environment variables are converted to strings, except in Bash where array values are not exported at all.
Korn shell will export just the first element. ksh93 also does some exec exploitation to preserve variable attributes exported to Korn shell children.
By the way, it is considered bad practice to use UPPERCASE for variable names, since they could collide with those used by the shell. Also, on Bash 3, the name STRING has issues when exported (fixed in Bash 4).