In my case I receive a Json with multiples lines, in Azure with this format. The number of lines that I receive are variable. The number of variables that I receive are also variable ( I can have up to 20)
{"Data":[
{"name":"Variable A","value":0.321721,"timecreated":"2018-1-15T11:10:7.977Z"},
{"name":"Variable B","value":-8.932533,"timecreated":"2018-1-15T11:10:8.17Z"},
{"name":"Variable C","value":-7.068326,"timecreated":"2018-1-15T11:10:8.58Z"},
{"name":"Variable A","value":-3.580420,"timecreated":"2018-1-15T11:10:8.98Z"},
{"name":"Variable C","value":1.549976,"timecreated":"2018-1-15T11:10:7.977Z"},
{"name":"Variable A","value":-8.701625,"timecreated":"2018-1-15T11:10:8.17Z"}]}
I would like to use something similar to this:
#r "Newtonsoft.Json"
using Newtonsoft.Json;
public class Variables
{
public string name="";
public string value="";
public string timecreated="";
}
public static void Run(Stream myBlob, string name, TraceWriter log)
{
log.Info($"C# Blob trigger function Processed blob\n Name:{name} \n Size: {myBlob.Length} Bytes");
var serializer = new JsonSerializer();
using (var sr = new StreamReader(myBlob))
using (var jsonTextReader = new JsonTextReader(sr))
{
var Values= (Variables)serializer.Deserialize(jsonTextReader,typeof(Variables));
// Do something with Values.
}
}
Having Values as an array of variables that aftewards I can handle for DDBB. Also a multiple dictionary list would be a good solution....Any idea?