So I need to parse file looking alike this:
{
pl: {
GENERIC: {
BACK: "COFNIJ",
WAIT: "CZEKAJ",
PAGES: {
ABOUTME: {
ID: "ID",
},
INFO: {
STATUS: "STATUS",
}
}
},
TOP_MENU: {
LOGGED: "Zalogowany",
OPTIONS: "Opcje",
}
},
en: {
GENERIC: {
BACK: "BACK",
WAIT: "WAIT",
PAGES: {
ABOUTME: {
ID: "ID",
},
INFO: {
STATUS: "STATUS",
}
}
},
TOP_MENU: {
LOGGED: "Logged",
OPTIONS: "Options",
}
}
}
But I don't know how many elements the file will have, so I can't create class to parse this file.
- My first question is how to wraped in c# the "no quotes" elements in file with double quotes to make this file json parsable ?
- How to parse above json file to tree data struture so it will looked like this:
Sample tree, so i can output on console every leaf node with path to it, an values in "en" and "pl" subtree ?
For example: path: generic/back en:"back" pl:"cofnij".
I've already tried to use Dictionary<string, dynamic> dictionary = JsonConvert.DeserializeObject<Dictionary<string, dynamic>>(file);
to get main keys, after converting above relaxed json to valid json, but I think the tree structure will be the more effective way.
Thanks for any help!