XSD to JSON Conversion CamelCase

This should cover W3C XML Schema, Relax NG and DTD related problems.
michaelgrudgings
Posts: 7
Joined: Mon Sep 12, 2022 7:58 pm

XSD to JSON Conversion CamelCase

Post 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"}
            }
Michael J Grudgings
Business Architect
florin_nica
Posts: 24
Joined: Wed Sep 09, 2020 3:17 pm

Re: XSD to JSON Conversion CamelCase

Post 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
michaelgrudgings
Posts: 7
Joined: Mon Sep 12, 2022 7:58 pm

Re: XSD to JSON Conversion CamelCase

Post by michaelgrudgings »

Much appreciated! I find it hard to believe I did not see that option when I generated the JSON. :lol:
Michael J Grudgings
Business Architect
Post Reply