• mholiv@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    2 months ago

    You have it mostly backwards. XML has like 40+ types that are all standardized. JSON only has the basic JS types. XML is a superset of JSON when it comes to types.

    How would you represent a double float, or binary data, or a datatime in JSON. You would have to use strings in JSON. In XML you would use the xsd:double, xsd:binary, and xsd:dateTime.

    JSON only works if you think in JavaScript. For languages with more complete / complex data systems it does not do unless you resort to the string thing.

    For your information:

    Easier to read: https://www.ibm.com/docs/en/jfsm/1.1.2.1?topic=queries-xsd-data-types

    The official spec: https://www.w3.org/TR/xmlschema-2/