Page 1 of 1

XSD to JSON Conversion CamelCase

Posted: Thu Dec 08, 2022 11:01 pm
by michaelgrudgings
Is there a setting to force JSON conversions to use camel case for the elements? When I convert the XSD, the JSON holds whatever format the XSD is in? I want to always convert to camel case if possible?

Code: Select all

        "PostalAddress": {
            "type": "object",
            "required": [
                "FirstLineAddress",
                "CityName",
                "PostalCode"
            ],
            "properties": {
                "FirstLineAddress": {"type": "string"},
                "SecondLineAddress": {"type": "string"},
                "ThirdLineAddress": {"type": "string"},
                "CityName": {"type": "string"},
                "StateProvinceCode": {"$ref": "#/$defs/StateProvince"},
                "PostalCode": {"type": "string"},
                "CountryCode": {"$ref": "#/$defs/Country"}
            }

Code: Select all

        "PostalAddress": {
            "type": "object",
            "required": [
                "firstLineAddress",
                "cityName",
                "postalCode"
            ],
            "properties": {
                "firstLineAddress": {"type": "string"},
                "secondLineAddress": {"type": "string"},
                "thirdLineAddress": {"type": "string"},
                "cityName": {"type": "string"},
                "stateProvinceCode": {"$ref": "#/definitions/StateProvince"},
                "postalCode": {"type": "string"},
                "countryCode": {"$ref": "#/definitions/Country"}
            }

Re: XSD to JSON Conversion CamelCase

Posted: Fri Dec 09, 2022 5:10 pm
by florin_nica
Hi Michael,

Thanks for your feedback.

You could try disabling the option "Preserve case of names from the XSD" within the dialog, which is checked by default. If unchecked, the resulting JSON Schema will not hold the same naming format as the XSD, and it should use a lowerCamelCase naming format. Notice that special characters such as: "-", "_", "." etc. are removed from the elements' name.

Regards,
Florin

Re: XSD to JSON Conversion CamelCase

Posted: Fri Dec 09, 2022 7:54 pm
by michaelgrudgings
Much appreciated! I find it hard to believe I did not see that option when I generated the JSON. :lol: