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
bonvoath
NA
19
3.5k
Please help me convert XML string to Json string
Apr 24 2017 9:57 PM
I'm try converting from xml string to json string as below:
I have xml string structure like this.
<
items
>
<
item
>
<
id
>
1
</
id
>
<
name
>
Name 1
</
name
>
</
item
>
<
item
>
<
id
>
2
</
id
>
<
name
>
Name 2
</
name
>
</
item
>
</
items
>
When I try convert to json. I got result as array of item. It's good result.
{
"items": {
"item": [
{
"id": "1",
"name": "Name 1"
},
{
"id": "2",
"name": "Name 2"
}
]
}
}
But when my xml have only one item.
<
items
>
<
item
>
<
id
>
1
</
id
>
<
name
>
Name 1
</
name
>
</
item
>
</
items
>
I got result as object of item.
{
"items": {
"item": {
"id": "1",
"name": "Name 1"
}
}
}
But the exactly result I want to get like this.
{
"items": {
"item": [
{
"id": "1",
"name": "Name 1"
}
]
}
}
Reply
Answers (
2
)
How to generate data matrix 2d bar code for c#
change buttons image according to values from database