问题
I need to parse a file which is in the following format:
"General"
{
"Description" = "Some Text"
"Version" = "4"
"ProjType" = "1"
}
"Configurations"
{
"Mice"
{
"BuildOutputs" = "BuildProject"
"OutputFile" = "output.txt"
}
"Men"
{
"BuildOutputs" = "BuildProject"
"ChangedSinceLastBuilt" = "True"
}
}
Does anyone have any idea what file format this is? If it's well known then there could be already made libraries to help parse it. It appears to be similar to JSON but instead of colons it uses equals sign and instead of commas it forcefully uses a new line.
回答1:
You could simply read in the entire file and then convert =
to :
and each line break with ,
- then you could parse it with an existing json library. Perhaps you would have to insert a ;
at the end of the data.
来源:https://stackoverflow.com/questions/9330761/what-is-this-file-format-called