Hi,
Can you try as the following?
- Surround the string with double quote
- replace inner double quote
"
with""
Sample
Regards,
Hi, you can use below format in assign activity
“[{‘Line Number’:‘1’,‘Product’:‘P7720’,‘Qty’:‘2’,‘Dis’:‘20’},{‘Line Number’:‘1’,‘Product’:‘P77STFLXA’,‘Qty’:‘1’,‘Dis’:‘0’},{‘Line Number’:‘1’,‘Product’:‘P77BRWSR’,‘Qty’:‘1’,‘Dis’:‘0’},{‘Line Number’:‘1’,‘Product’:‘P77deskew’,‘Qty’:‘1’,‘Dis’:‘0’}]”
OR
“{‘Line Number’:‘1’,‘Product’:‘P7720’,‘Qty’:‘2’,‘Dis’:‘20’},{‘Line Number’:‘1’,‘Product’:‘P77STFLXA’,‘Qty’:‘1’,‘Dis’:‘0’},{‘Line Number’:‘1’,‘Product’:‘P77BRWSR’,‘Qty’:‘1’,‘Dis’:‘0’},{‘Line Number’:‘1’,‘Product’:‘P77deskew’,‘Qty’:‘1’,‘Dis’:‘0’}”
No Guys. What i’m trying to acheive here is,
- i will have this text in the queue item
- I need to extract that will specific content(“product”) and convert it to datatable
but for the testing purpose, im not stroing that in the queue. Instead of that , how can i store it into a variable?
str_Name="{""Line Number"": ""1"", ""Product"": ""P7720"", ""Qty"":""2"", ""Dis"": ""20""}"",""{""Line Number"": ""1"", ""Product"": ""P77STFLXA"", ""Qty"": ""1"", ""Dis"": ""0""}"",""{""LineNumber"": ""1"", ""Product"": ""P77BRWSR"", ""Qty"": ""1"", ""Dis"": ""0""}"",""{""LineNumber"": ""1"",""Product"": ""P77DESKEW"", ""Qty"": ""1"",""Dis"": ""0""}"
Regards
No need to use Deserialize JSON activity.
In the assign activity the var JSON is of datatype string.
While we replacing the " with “” it is converting to str format
Then, how can i convert that data into datattable?
@vrdabberu
to convert json into datatable
Outpu_DT=Newtonsoft. Json.jsonconvert.DeserializeObject(of Datatable) (Newtonsoft.json.Linq.Jobject.Parse(Inputfile.txt)(“data”).Tostring)
cheers!!
Try this:
text = "[{""Line Number"": ""1"", ""Product"": ""P7720"", ""Qty"":""2"", ""Dis"": ""20""},{""Line Number"": ""1"", ""Product"": ""P77STFLXA"", ""Qty"": ""1"", ""Dis"": ""0""},{""LineNumber"": ""1"", ""Product"": ""P77BRWSR"", ""Qty"": ""1"", ""Dis"": ""0""},{""LineNumber"": ""1"",""Product"": ""P77DESKEW"", ""Qty"": ""1"",""Dis"": ""0""}]"
dt = Newtonsoft.Json.JsonConvert.DeserializeObject(Of DataTable)(text)
tnx for this!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.