using System.Collections.Generic;
using Newtonsoft.Json.Linq;
public static void Main()
string levelList = "Country, State, City, Area";
public static void IsFunc(string tags, string levelList)
if (!string.IsNullOrEmpty(tags) && !string.IsNullOrEmpty(levelList))
var levels = levelList.Split(',');
foreach (var level1 in JObject.Parse(tags))
Console.WriteLine(rowindex++ + "\t" + level1.Key + "\t" + levels[0] + "\tnull");
goDeep(level1, levels, 2);
public static void goDeep(KeyValuePair<string,JToken> tags, string[] levels, int level)
var value = JObject.Parse(tags.Value.ToString());
if (value == null) return;
foreach (var data in value)
Console.WriteLine(rowindex++ + "\t" + data.Key + "\t" + levels[level-1]+ "\t" + tags.Key);
goDeep(data, levels, level+1);