Eric I dream of a tool which will tell me what obscure (or not so obscure) data structuring format something is stored in just by copy-pasting in the file contents. This would be very useful when a custom file-ext is being used (eg. saveGames). This tool probably already exists in multiple forms, right now I'm trying to figure something which looks like JSON & XML at once.
Mark Dain Sounds like file(1) to me? "file <filename>" will determine (with disturbing accuracy) what kind of file it is. Here's the man page: linux.die.net/man/...
8y, 28w 4 replies
Martijn Isn't that mostly based on magic numbers though? If is talking about data files stored in basic ASCII there is no way to discern JSON from CSV without parsing the data in some way. I don't believe `file` does that?
8y, 28w 3 replies
Login or register your account to reply
Nkrs AFAIK the 'file' program uses magic numbers to detect file types instead of extensions or MIME types: en.wikipedia.org/w...
8y, 28w reply
Mark Dain Seems you're right it can't tell the difference between JSON and CSV... That's disappointing considering it can often tell the text is in English. would it be possible to upload the file? Perhaps we could try telling what format it's in
8y, 28w 1 reply
Eric It's a huge file, one of Victoria 2's game engine resources. It's pretty much json but with = rather : and no commas. I think a clever regex fueled find and replace might pull a forced conversion.
8y, 28w reply