→ My goal is to achieve reading data from excel and generate json body for each row where “Part” and “Direction” field is always same and not from excel …
→ Data that we need to read from excel is “DEODE”,“DEFERENCE”,“OPERATDE”, “POSITION”,“TARI_ODE”,“GOODS_NAME”,
=> Use Read Range Workbook to read the excel to data table
Output → dt
=> Use the below syntax in Assign activity:
jsonArray = New JArray(
From row In dt.AsEnumerable()
Select New JObject(
New JProperty("Part", "1"),
New JProperty("Direction", "N"),
New JProperty("DEODE", row("DEODE").ToString()),
New JProperty("DEFERENCE", row("DEFERENCE").ToString()),
New JProperty("OPERATDE",(row("OPERATDE"))),
New JProperty("POSITION", row("POSITION").ToString()),
New JProperty("TARI_ODE", row("TARI_ODE").ToString()),
New JProperty("GOODS_NAME", row("GOODS_NAME").ToString())
)
)
Note: jsonArray is of DataType Newtonsoft.Json.Linq.JArray
=> Use the below syntax to convert to jsonString jsonString = jsonArray.ToString()