My goal is to convert a string to a ByteArray, write this ByteArray AS a ByteArray to a string so it's unreadable but still readable again upon "ByteArray to String" conversion in C#.
This is how my code is right now:
string json = "{\"database\":{\"tables\":{\"Users\":[\"column\":{\"id\":\"1\", \"name\":\"Test\"}]}}}"; var bytes = Encoding.ASCII.GetBytes(json); File.WriteAllBytes("database.dat", bytes); This works in theory, however the final output file has the same content of the string, and not the converted ByteArray. This is what the file contains:
database.dat
{"database":{"tables":{"Users":["column":{"id":"1", "name":"Test"}]}}}
But I expected something like
l4@ˆC}nC(YXX>AI0ve‚22úL«*“ÑÃYgPæaiäi ’Ê¢±·Ä¿|^Û×RÉ!×¹ÝYPZŠO•QÚÉèT“g‘Ѳ¬¡\g²Ô
What am I doing wrong? Is this not a ByteArray? Is there another way to convert data to an unreadable file, and then be able to convert it back into a string in my program?