TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Rameez Javed
NA
395
61.5k
Converting Dataset to Json with Empty datatable's columns
Dec 7 2020 11:03 PM
Hi everyone, I want to convert DataSet to Json using newtonsoft. I converted it successfully but an issue here is the datatable with 0 rows are column less in json.
I'm getting the json like below, but I want to have dt_3 with its columns names.
What I'm doing is
string
json_withoutStoreDetails = JsonConvert.SerializeObject(dset, Newtonsoft.Json.Formatting.Indented);
{
"dt_1"
: [
{
"depid"
: 51.0,
"DepName"
:
"Honda"
,
"Amount"
: 110.50
},
{
"depid"
: 54.0,
"DepName"
:
"Toyota"
,
"Amount"
: 100.60
},
{
"depid"
: 56.0,
"DepName"
:
"Diahatsu"
,
"Amount"
: 120.00
},
{
"depid"
: 57.0,
"DepName"
:
"Bedford"
,
"Amount"
: 380.00
},
],
"dt_2"
: [
{
"depid"
: 50,
"DepName"
:
"AlloyRims"
,
"Amount"
: 21.50
}
],
"dt_3"
: [
],
}
Reply
Answers (
3
)
show and hide dropdown on hover?
Face Null Value Error.