|
 Lol im completely new to JSON so sorry for not knowing exactly what its supposed to do Heres the code to convert it to classes. I used quicktype.io to help me
<pre>
namespace quicktype
{
using System;
using System.Collections.Generic;
using System.Globalization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
public partial class Welcome
{
[JsonProperty("PropertyInfos")]
public List<PropertyInfo> PropertyInfos { get; set; }
}
public partial class PropertyInfo
{
[JsonProperty("Identification")]
public Identification Identification { get; set; }
[JsonProperty("PropertyName")]
public string PropertyName { get; set; }
[JsonProperty("ManagementCompany")]
public ManagementCompany ManagementCompany { get; set; }
[JsonProperty("Address")]
public Address Address { get; set; }
}
public partial class Address
{
[JsonProperty("Address")]
public string AddressAddress { get; set; }
[JsonProperty("City")]
public string City { get; set; }
[JsonProperty("State")]
public string State { get; set; }
[JsonProperty("PostalCode")]
[JsonConverter(typeof(ParseStringConverter))]
public long PostalCode { get; set; }
[JsonProperty("Email")]
public string Email { get; set; }
}
public partial class Identification
{
[JsonProperty("IDValue")]
[JsonConverter(typeof(ParseStringConverter))]
public long IdValue { get; set; }
}
public partial class ManagementCompany
{
[JsonProperty("ManagementCompanyName")]
public string ManagementCompanyName { get; set; }
[JsonProperty("Identification")]
public Identification Identification { get; set; }
}
public partial class Welcome
{
public static Welcome FromJson(string json) => JsonConvert.DeserializeObject<Welcome>(json, quicktype.Converter.Settings);
}
public static class Serialize
{
public static string ToJson(this Welcome self) => JsonConvert.SerializeObject(self, quicktype.Converter.Settings);
}
internal static class Converter
{
public static readonly JsonSerializerSettings Settings = new JsonSerializerSettings
{
MetadataPropertyHandling = MetadataPropertyHandling.Ignore,
DateParseHandling = DateParseHandling.None,
Converters =
{
new IsoDateTimeConverter { DateTimeStyles = DateTimeStyles.AssumeUniversal }
},
};
}
internal class ParseStringConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(long) || t == typeof(long?);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
if (reader.TokenType == JsonToken.Null) return null;
var value = serializer.Deserialize<string>(reader);
long l;
if (Int64.TryParse(value, out l))
{
return l;
}
throw new Exception("Cannot unmarshal type long");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
if (untypedValue == null)
{
serializer.Serialize(writer, null);
return;
}
var value = (long)untypedValue;
serializer.Serialize(writer, value.ToString());
return;
}
public static readonly ParseStringConverter Singleton = new ParseStringConverter();
}
}
Now ive created a class in c# where i can access these classes. How do i get JSON to put my POST data into these classes. Or are you able to point me to a video, guide, etc that could help me learn this
|
|
|
|
|
As I said, I prefer Newtonsoft, so follow the link in my original response, and it'll show you how to deserialize it. It's only one line of code!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
|
There is a requirement to send and receive data over TCP/IP with a Fiscal (tax) device which acts as a gateway to the Tax authority server.
The application runs on c#.
Can anyone suggest suitable c# libraries which can be used for this purpose?
The data is to be packaged in JSON format.
Any help would be very much appreciated.
|
|
|
|
|
|
ICARUS999 wrote: There is a requirement to send and receive data over TCP/IP with a Fiscal (tax) device which acts as a gateway to the Tax authority server. Have you researched the API, and/or requirements/protocols/syntax/authorization, for interop with the specific device you describe ?
«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali
|
|
|
|
|
hello
have searched google a lot but couldn't find any.
i am trying to create a report in visual studio 2019. data is coming from SQL server and using
reportViewer1 to print the report.
can someone show me a good tutorial on it.
|
|
|
|
|
The reportViewer control has print controls on it. Did you try those?
|
|
|
|
|
i can't get to show data in the report.
i even tried with report wizard too.
first created a dataset then in the dataset created data table.
after this report filed headers are added to the report and when i run report shows only header names but no data.
|
|
|
|
|
It's been a long time since I have used it so I don't remember any specifics but it sounds like either the sql is not being executed or it is and it's not returning data.
Try using Sql profiler on your database to see if any sql is being executed.
|
|
|
|
|
|
Hey,
The idea is very simple, as Blazor can run ether as a Webassembly or over SignalR, shouldn`t it be possible when using a SignalR connection, to mirror the whole website of a user?
Like for support purposes, to inject a support person directly into what the user is seeing by mirroring the connection and replay all actions from one user to the output of another one?
|
|
|
|
|
Hi all hacking members I am new join
|
|
|
|
|
Wrong site: this is not a hacking site, and we do not condone, support, or assist in the production of malicious code in any way, form, or manner. This is a professional site for professional developers.
You will get no help hacking anything here.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
|
That's why I didn't add a report in S&A.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
What's wrong with hacking? I had a parrot doing it all the time!
|
|
|
|
|
In the words of Biff Tannen: "I think you've got the wrong car, McFly."
|
|
|
|
|
I like hacking. That's one of the best ways to learn how things work. Do you have a question?
|
|
|
|
|
Learning how to exploit a vulnerability teaches not how to code.
Been doing development for over 20 years, and a "little" paranoid. Sporting my own hostfile and delivering updates to multiple hosts.
I like education.
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Eddy Vluggen wrote: Learning how to exploit a vulnerability teaches not how to code. Sure it can.
Just like SQL injection. That's hacking but we talk about it all the time. Hacking is a good way to learn how things work.
|
|
|
|
|
20212 wrote: Sure it can. No, it doesn't; it teaches nothing about patterns, not even about security, it only shows where breaches are.
20212 wrote: Just like SQL injection Thank you for proving my point.
20212 wrote: That's hacking but we talk about it all the time. Hacking is a good way to learn how things work. It's a way of learning to know about weaknesses, not about how things work. Here an analogy for ya; you claim you can run an atomic power plant, because you know an unguarded door. In my opinion, you not even less qualified than any real programmer, but a liability.
And you know you are; that's why I post under my real name, and you don't dare too.
--edit
From a real criminal; do you have any questions?
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Eddy Vluggen wrote: Thank you for proving my point. I don't think you understand your point then.
If all we told people is to use parameterized queries but did not explain why, the lesson would not be learned as well. Explaining how non-parameterized queries can allow someone to hack your db is magnitudes more valuable than just telling them to use parameters.
Eddy Vluggen wrote: that's why I post under my real name, and you don't dare too. 1. You can't prove that it's your real name.
2. You can't prove this is not my real name.
|
|
|
|
|
20212 wrote: I don't think you understand your point then. Not my problem, is it?
20212 wrote: If all we told people is to use parameterized queries but did not explain why, the lesson would not be learned as well. Explaining how non-parameterized queries can allow someone to hack your db is magnitudes more valuable than just telling them to use parameters. Again, thanks for proving my point
20212 wrote: 1. You can't prove that it's your real name. I can, there's a photograph on here from me. Look it up. No, no record government linking me to that, I not that much of a fool.
20212 wrote: 2. You can't prove this is not my real name. Easy, that's not even a legal name; you're not allowed to name children like that.
I been a developer for over 20 years. Been concerned with security for the same time. We "know a bit" about the subject
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|