public static void Main(string[] args) { var SrcJsonConnstring = "DefaultEndpointsProtocol=https;AccountName=lkedevmain;AccountKey=l0W0CaoNiRZQIqJ536sIScSV5fUuQmPYRQYohj/UjO7+ZVdpUiEsRLtQMxD+1szNuAeJ351ndkOsdWFzWBXmdw==;"; var DestConnString = ""; var nameBuilder = new NameBuilder(); var json = new AzureBlobStorage(SrcJsonConnstring).GetAsTextAsync("settings", "globalsettings.json").Result; Console.WriteLine(); Console.WriteLine(json); Console.WriteLine(); using (var reader = new JsonTextReader(new StringReader(json))) { while (reader.Read()) { if (reader.TokenType == JsonToken.PropertyName) { nameBuilder.Add(reader.Value.ToString()); } if (reader.TokenType == JsonToken.String) { WriteToDb(nameBuilder, '"' + reader.Value.ToString() + '"'); } if (reader.TokenType == JsonToken.Boolean) { WriteToDb(nameBuilder, reader.Value.ToString()); } if (reader.TokenType == JsonToken.Integer) { WriteToDb(nameBuilder, reader.Value.ToString()); } if (reader.TokenType == JsonToken.EndObject) { nameBuilder.RemoveLast(); } if (reader.TokenType == JsonToken.StartArray) { Console.WriteLine("----------- Start Array -----------"); } if (reader.TokenType == JsonToken.EndArray) { Console.WriteLine("----------- End Array -----------"); } } } }
private static void WriteToDb(NameBuilder nb, string value) { Console.WriteLine("{0} : {1}", nb.ToString(), value); nb.RemoveLast(); }