Skip to content

Some C# classes created from Json have invalid name #113

@JaySchwarz

Description

@JaySchwarz

I'm trying to interface with an API that uses lots of field names that are all numeric. In most cases, the Json->C# tool does a great job of starting the field or class name with an underscore, but not always.

Here is a sample of what I'm seeing in Visual Studio after I copy in the class from the clipboard. This is my first project using JSON with a 3rd Party API, so maybe I'm doing something wrong. Thanks. Otherwise, I love the tool!

public class _949956117
{
public string value { get; set; }
public string name { get; set; }
}

public class 1216986445
{
public string field_type { get; set; }
public string street_address { get; set; }
public string city { get; set; }
public string state { get; set; }
public string zip { get; set; }
public string longitude { get; set; }
public string latitude { get; set; }
public string is_primary { get; set; }
public string is_private { get; set; }
}

public class 1995837313
{
    public string address { get; set; }

public string is_primary { get; set; }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions