Deserialized an object into a DataTable
up vote
0
down vote
favorite
I have a JSON
response like this:
{ "cod": "OK",
"list": [
{ "date": "31/10/2018", "count": "109", "name": "PAUL" },
{ "date": "30/09/2018", "count": "103", "name": "LUKE" }
]}
I use:
Dim jss As New JavaScriptSerializer
Dim Response = jss.Deserialize(Of Object)(strResponse)
Dim Cod = Response("cod")
Then:
Dim Lista_documents = Response("list")
And I have an object with the list of documents.
How can I populate a new DataTable
?
json vb.net datatable
add a comment |
up vote
0
down vote
favorite
I have a JSON
response like this:
{ "cod": "OK",
"list": [
{ "date": "31/10/2018", "count": "109", "name": "PAUL" },
{ "date": "30/09/2018", "count": "103", "name": "LUKE" }
]}
I use:
Dim jss As New JavaScriptSerializer
Dim Response = jss.Deserialize(Of Object)(strResponse)
Dim Cod = Response("cod")
Then:
Dim Lista_documents = Response("list")
And I have an object with the list of documents.
How can I populate a new DataTable
?
json vb.net datatable
You didn't explain how you want to populate it.
– CruleD
Nov 10 at 13:07
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have a JSON
response like this:
{ "cod": "OK",
"list": [
{ "date": "31/10/2018", "count": "109", "name": "PAUL" },
{ "date": "30/09/2018", "count": "103", "name": "LUKE" }
]}
I use:
Dim jss As New JavaScriptSerializer
Dim Response = jss.Deserialize(Of Object)(strResponse)
Dim Cod = Response("cod")
Then:
Dim Lista_documents = Response("list")
And I have an object with the list of documents.
How can I populate a new DataTable
?
json vb.net datatable
I have a JSON
response like this:
{ "cod": "OK",
"list": [
{ "date": "31/10/2018", "count": "109", "name": "PAUL" },
{ "date": "30/09/2018", "count": "103", "name": "LUKE" }
]}
I use:
Dim jss As New JavaScriptSerializer
Dim Response = jss.Deserialize(Of Object)(strResponse)
Dim Cod = Response("cod")
Then:
Dim Lista_documents = Response("list")
And I have an object with the list of documents.
How can I populate a new DataTable
?
json vb.net datatable
json vb.net datatable
edited Nov 10 at 9:50
Jimi
6,01621033
6,01621033
asked Nov 10 at 8:25
LukaGer
92
92
You didn't explain how you want to populate it.
– CruleD
Nov 10 at 13:07
add a comment |
You didn't explain how you want to populate it.
– CruleD
Nov 10 at 13:07
You didn't explain how you want to populate it.
– CruleD
Nov 10 at 13:07
You didn't explain how you want to populate it.
– CruleD
Nov 10 at 13:07
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
I am not aware of any methods that will do it automatically, so probably with a Loop.
Dim table As New DataTable
table.Columns.Add("date", GetType(Date))
table.Columns.Add("count", GetType(Integer))
table.Columns.Add("name", GetType(String))
For Each Li In Lista_documents
table.Rows.Add(Li("date"), Li("count"), Li("name"))
Next
Adjust depending on how your Lista_documents is structured
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
I am not aware of any methods that will do it automatically, so probably with a Loop.
Dim table As New DataTable
table.Columns.Add("date", GetType(Date))
table.Columns.Add("count", GetType(Integer))
table.Columns.Add("name", GetType(String))
For Each Li In Lista_documents
table.Rows.Add(Li("date"), Li("count"), Li("name"))
Next
Adjust depending on how your Lista_documents is structured
add a comment |
up vote
0
down vote
I am not aware of any methods that will do it automatically, so probably with a Loop.
Dim table As New DataTable
table.Columns.Add("date", GetType(Date))
table.Columns.Add("count", GetType(Integer))
table.Columns.Add("name", GetType(String))
For Each Li In Lista_documents
table.Rows.Add(Li("date"), Li("count"), Li("name"))
Next
Adjust depending on how your Lista_documents is structured
add a comment |
up vote
0
down vote
up vote
0
down vote
I am not aware of any methods that will do it automatically, so probably with a Loop.
Dim table As New DataTable
table.Columns.Add("date", GetType(Date))
table.Columns.Add("count", GetType(Integer))
table.Columns.Add("name", GetType(String))
For Each Li In Lista_documents
table.Rows.Add(Li("date"), Li("count"), Li("name"))
Next
Adjust depending on how your Lista_documents is structured
I am not aware of any methods that will do it automatically, so probably with a Loop.
Dim table As New DataTable
table.Columns.Add("date", GetType(Date))
table.Columns.Add("count", GetType(Integer))
table.Columns.Add("name", GetType(String))
For Each Li In Lista_documents
table.Rows.Add(Li("date"), Li("count"), Li("name"))
Next
Adjust depending on how your Lista_documents is structured
edited Nov 10 at 16:35
answered Nov 10 at 16:04
Simon Evans
11617
11617
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53237253%2fdeserialized-an-object-into-a-datatable%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You didn't explain how you want to populate it.
– CruleD
Nov 10 at 13:07