I have a very specific JSON file, which format is quite annoying to deal with but no choice. This is really blocking me for such an easy task :
const data =
{
"country":
{
"France" :
{
"owners" : ["peter", "john"],
"members" : [ "james", "paul"]
},
"Germany" :
{
"owners" : ["Tom", "Omar"],
"members" : ["Zak", "Eddie", "Ronald"]
},
"Spain" :
{
"owners" : ["Juan"],
"members" : ["Clement", "Max"]
}
}
}
All I want is a function that gets me the country of a specific user (Doesn't matter if he's among members or owners). For example :
GetUserCountry(data, 'Ronald'); // Should return 'Germany'
I know it's really simple but the format of the file won't let me do my things.