I am trying to write to a file an array of object serialised into JSON format. I am trying to write it in two different way as shown below.
ToSerialise[] Ob
Even though the content of both the files are same, they have different file size.
If they have a different size, then they definitely have different contents. A file is (pretty much) just a sequence of bytes - and if two sequences have different lengths, they're different sequences.
In this case, the two files both represent the same text, but using different encodings - file2
will use UTF-8, and file1
will use UTF-16.
To think of it a different way: if you saved the same picture to two files, one as JPEG and one as PNG, would you expect the files to be the same size?