bladefist / jsonutils Goto Github PK
View Code? Open in Web Editor NEWJson to C#, VB.Net, Javascript and SQL Server Table
License: GNU General Public License v2.0
Json to C#, VB.Net, Javascript and SQL Server Table
License: GNU General Public License v2.0
Just wondering if you plan on supporting Typescript interface generation at some point in the future.
Is it possible to support associative arrays in the future or is there a reason this couldn't happen? I suspect some sort of hint would need to be provided to indicate they should be used.
Since .NET Core 3, there is a new feature to serialize / deserialize Json integrated to .NET Core 3.
The attribute JsonPropertyName(string)
is used to set the name of the property.
When comparing objects it is necessary to have an equals() method.
When a property starts with a number, VB complains in the class.
For VB, when a property starts with a number, prefix the name with '_' underscore.
Example of URL with property starting with number:
https://api.coinmarketcap.com/v1/ticker/bitcoin/
Thanks.
Each line of code inside a function or a member variable declaration should end with ";"
has been for a few days
Just checking if this is an error or you have shut the service down.
TA
The following json doesn't parse to C# properly. The C# output doesn't include types for several properties.
[
{
"id": "Jq74mCczmFXk1tC10GB",
"merchant_id": "JGHJ0343",
"created_at": "2014-07-07T18:45:00Z",
"creator_id": "18YC4JBH91E1G",
"device": {
"name": "Front of store"
},
"payment_url": "https://squareup.com/dashboard/sales/transactions/Jq74mCczmFXk1tC10GB",
"inclusive_tax_money": {
"currency_code": "USD",
"amount": 0
},
"additive_tax_money": {
"currency_code": "USD",
"amount": 24
},
"tax_money": {
"currency_code": "USD",
"amount": 24
},
"tip_money": {
"currency_code": "USD",
"amount": 0
},
"discount_money": {
"currency_code": "USD",
"amount": -45
},
"total_collected_money": {
"currency_code": "USD",
"amount": 429
},
"processing_fee_money": {
"currency_code": "USD",
"amount": -12
},
"net_total_money": {
"currency_code": "USD",
"amount": 417
},
"refunded_money": {
"currency_code": "USD",
"amount": 0
},
"inclusive_tax": [],
"additive_tax": [
{
"name": "Sales tax",
"rate": "0.060000",
"inclusion_type": "ADDITIVE",
"applied_money": {
"currency_code": "USD",
"amount": 24
}
}
],
"tender": [
{
"type": "CREDIT_CARD",
"name": "Credit Card",
"total_money": {
"currency_code": "USD",
"amount": 429
},
"card_brand": "DISCOVER",
"pan_suffix": "1117",
"entry_method": "SWIPED"
}
],
"refunds": [],
"itemizations": [
{
"name": "Milkshake",
"quantity": "1.00000000",
"notes": "Delicious!",
"item_variation_name": "Small",
"item_detail": {
"category_name": "Beverages",
"sku": "123",
"item_id": "a1c50178-19ad-4783-aee4-4f2548ca8254",
"item_variation_id": "8219dd37-666f-4855-be73-b5d28826580b"
},
"total_money": {
"currency_code": "USD",
"amount": 429
},
"single_quantity_money": {
"currency_code": "USD",
"amount": 400
},
"gross_sales_money": {
"currency_code": "USD",
"amount": 450
},
"discount_money": {
"currency_code": "USD",
"amount": -45
},
"net_sales_money": {
"currency_code": "USD",
"amount": 405
},
"taxes": [
{
"name": "Sales tax",
"rate": "0.060000",
"inclusion_type": "ADDITIVE",
"applied_money": {
"currency_code": "USD",
"amount": 24
},
"fee_id": "19498df7-3fb0-4c96-8b47-860480718abk"
}
],
"discounts": [
{
"name": "Early Bird",
"applied_money": {
"currency_code": "USD",
"amount": -45
},
"discount_id": "0f075287-094c-4de7-9e23-cff5d41c910b"
}
],
"modifiers": [
{
"name": "Whipped Cream",
"applied_money": {
"currency_code": "USD",
"amount": 50
},
"modifier_option_id": "39059fd0-ae9d-4eb3-b6e8-dd3198f019b8"
}
]
}
]
}
]
Title. I'm missing the python json class generator.
Currently setter methods have a return type, but they should be void
JsonProperties use nbsp character instead of standard space which Json Library does not recognize as a space, thus failing the member match and breaking deserialization. This issue only occurred when using copy to clipboard button. Copy via highlight works as is recognized as a normal space. Only tested with chrome browser.
Using the following JSON:
{ "command" : "testcommand", "data" : [ { "name" : "NameOfTheObject", "values" : { "Item1" : [ "Value1" ], "Item2" : [ "Value2" ], "Item3" : [ "Value3" ], "Item4" : [ "Value4" ], "Item5" : [ "Value5" ] } } ], "status" : "success" }
Incorrectly outputs the following SQL:
create table Values (
[Id] [int] IDENTITY(1,1) NOT NULL,
[Item1] IList<[varchar](50) NULL>,
[Item2] IList<[varchar](50) NULL>,
[Item3] IList<[varchar](50) NULL>,
[Item4] IList<[varchar](50) NULL>,
[Item5] IList<[varchar](50) NULL>,
CONSTRAINT [PK_Values] PRIMARY KEY CLUSTERED
(
[Id] asc
)
)
The correct output should be:
create table Values (
[Id] [int] IDENTITY(1,1) NO NULL,
[Item1] [varchar](50) NULL,
[Item2] [varchar](50) NULL,
[Item3] [varchar](50) NULL,
[Item4] [varchar](50) NULL,
[Item5] [varchar](50) NULL,
CONSTRAINT [PK_Values] PRIMARY KEY CLUSTERED
(
[Id] asc
)
)
Hello guys!
I've inserted this JSON to the application:
{"?xml":{"@version":"1.0","@encoding":"UTF-8","@standalone":"yes"},"ns2:FeedAcknowledgement":{"@xmlns:ns2":"http://walmart.com/","ns2:feedId":"xxxxxx"}}
And I got this as result:
As you can see it generated the attributes with special caracters... There is a way we can remove all this special caracters and return clean attributes?
Thanks!
When generating php classes, the type is put as a trailing comment next to the field.
I think it'd make sense to switch this to phpdoc comments as it is used in many IDEs + documentation generation tools
Let us pick array or List for collection properties in vb/c# outputs.
I hit an example of where a C# class was generated but a couple of properties had their type missing and so the code will not compile until manually edited.
Here is the sample input from GitHub documentation about their Webhooks. If you paste that into the jsonutils website it generates a bunch of classes including these two:
public class Commit
{
public string id { get; set; }
public string tree_id { get; set; }
public bool distinct { get; set; }
public string message { get; set; }
public DateTime timestamp { get; set; }
public string url { get; set; }
public Author author { get; set; }
public Committer committer { get; set; }
public IList<object> added { get; set; }
public IList<object> removed { get; set; }
public IList<string> modified { get; set; }
}
public class HeadCommit
{
public string id { get; set; }
public string tree_id { get; set; }
public bool distinct { get; set; }
public string message { get; set; }
public DateTime timestamp { get; set; }
public string url { get; set; }
public author { get; set; }
public committer { get; set; }
public IList<object> added { get; set; }
public IList<object> removed { get; set; }
public IList<string> modified { get; set; }
}
As you can see the author
and committer
properties in the HeadCommit
class have no type whereas in the Commit
class they are correct.
Also these class are identical and so I wonder if the utility could detect (some final step in the processing) that it has created duplicate classes and then remove the dupes and adjust the final class structure to use that one type?
When selecting the "Add Namespace" checkbox, could there also be a textbox that allows the user to enter their own namespace (instead of it defaulting to JSONUtils)?
Hi support, semicolon is missing in generated php code
I have noticed when place json in that contains a keyword as a property, it will end up being called that in the c# code which will not compile.
For example
{
"private": true
}
result:
public class PullRequestHook
{
[JsonProperty("private")]
public bool private { get; set; }
}
This won't compile since private is a keyword.
keywords such as ref, head, base, async,private, protected, etc
should switch cases, or rename the properties in some manor so it will compile.
Selecting VB.Net and DataMember attributes, we get JsonProperty attributes.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.