Giter Site home page Giter Site logo

jsonutils's People

Contributors

a-orlov avatar bladefist avatar cihanyakar avatar ionixjunior avatar ncubed avatar ranga543 avatar the-amber-joy avatar viteralex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jsonutils's Issues

Associative arrays (or Dictionary in C#)

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.

Add JsonPropertyName for System.Text.Json

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.

Json to C# doesn't parse properly.

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"
}
]
}
]
}
]

clipboard shortcut on site gives erroneous data

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.

Converting to 'SQL Table' creates columns with 'IList<[varchar](50) NULL>' columns

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
   )
)

Generating attributes with special caracters

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:

image

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!

Pls add support new JsonAttributes for .NET Core 3.0 Json Serializer

Hi,

.NET Core 3.0 brings a new Json Serializer (System.Text.Json.Serialization). New attribute names for the data members came along with this. Please add 'JsonPropertyName' to the selection box (C#).
Change class IndexViewModel:
image

And class CSharpCodeWriter:
image

Thank you :-)

Sporadic absence of generated property types for C#

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?

Add field for Namespace

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)?

filter out key words

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.