15,910,981 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Temirgali (Top 4 by date)
Temirgali
7-Jan-16 22:07pm
View
Thank you very much! It really helps to me.
Temirgali
7-Jan-16 6:12am
View
[{
id: 13421,
user_name: "Student Student1",
card_number: "0005836821",
breakfasts: "1111111",
lunchs: "1111111",
dinners: "1111111",
start_date: "09/10/2015 00:01",
end_date: "31/10/2015 23:59",
canteen: "Askhana 1",
only_once: false,
gtransactions: [
{
gdeal_id: 13421,
meal_time: "09/10/2015 15:40",
jana: false
}
]
},
{
id: 9420,
user_name: "super nexus 5",
id_number: "2911ce71",
card_number: "a04c797a714dfe01",
breakfasts: "1111111",
lunchs: "1111111",
dinners: "1111111",
start_date: "01/09/2015 00:01",
end_date: "30/09/2015 23:59",
canteen: "Askhana 2",
only_once: true,
gtransactions: [ ]
},
{
id: 9421,
user_name: "Student Student3",
card_number: "1112223337",
breakfasts: "1111111",
lunchs: "1111111",
dinners: "1111111",
start_date: "01/08/2015 00:01",
end_date: "31/08/2015 23:59",
canteen: "Askhana 1",
only_once: true,
gtransactions: [ ]
},
{
id: 14729,
user_name: "Studenr student",
card_number: "31303353",
breakfasts: "1111111",
lunchs: "1111111",
dinners: "1111111",
start_date: "02/12/2015 00:01",
end_date: "22/04/2016 23:59",
canteen: "Askhana 1",
only_once: true,
gtransactions: [
{
gdeal_id: 14729,
meal_time: "30/12/2015 12:37",
jana: false
}
]
},
{
id: 14730,
user_name: "Studenr student",
id_number: "7777777777776476",
card_number: "05f06521",
breakfasts: "0000000",
lunchs: "1111100",
dinners: "0000000",
start_date: "01/12/2015 00:01",
end_date: "27/12/2015 23:59",
canteen: "Askhana 1",
only_once: true,
gtransactions: [
{
gdeal_id: 14730,
meal_time: "01/10/2015 19:54",
jana: false
}
]
}
]
here is all completed JSON. I want it in c# i already did it but,i have problem with "gtransaction" part.
here a code:
public class MyObject
{
public int id { get; set; }
public string user_name { get; set; }
public string id_number { get; set; }
public string card_number { get; set; }
public string breakfasts { get; set; }
public string lunchs { get; set; }
public string dinners { get; set; }
public DateTime start_date { get; set; }
public DateTime end_date { get; set; }
public string only_once { get; set; }
}
download JSON
private static T downloadJsonData<t>(string url) where T : new() {
using (var w = new WebClient()) {
var jData = string.Empty;
try
{
jData = w.DownloadString(url);
}
catch (Exception) { }
return !string.IsNullOrEmpty(jData) ? JsonConvert.DeserializeObject<t>(jData) : new T();
}
}
private void button1_Click(object sender, EventArgs e)
{
var url = "http://185.98.5.184:9000/users/dealed/Test";
var obj = downloadJsonData<myobject>(url);
var db = new Models.Database1Entities();
db.Users.Add(new Models.Users
{
user_name = obj.user_name,
Id = obj.id,
id_number = obj.id_number,
card_number = obj.card_number,
card_number = obj.card_number,
breakfasts = obj.breakfasts,
lunchs = obj.lunchs,
dinners_ = obj.dinners,
only_once = obj.only_once,
start_date = obj.start_date,
end_date = obj.end_date
});
Temirgali
7-Jan-16 3:07am
View
yes, you are right. my json like you typed, I just copied part, I guess it is understandable for developers. but, there problem isn't with json, problem with getting it. How can I map it into datatable. I don't have any idea.
Temirgali
6-Jan-16 22:30pm
View
What about this JSON? What's wrong with it?