Search code examples
jsonxmldataformat

How to recognize data format


I have same type of data in two format but I not sure which format they are.

Data format 1

{
  "ArraytionGroup": {
    "-xmlns:xsd": "http://www.w3.org/2001/XMLSchema",
    "-xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
    "LocationGroup": [
      {
        "Id": "6",
        "Uuid": "894055b6-971ecc0c7224",
        "Name": {
          "-xmlns": "http://www.air-watch.com/servicemodel/resources",
          "#text": "gtg"
        },
        "GroupId": { "-xmlns": "http://www.air-watch.com/servicemodel/resources" },
        "LocationGroupType": {
          "-xmlns": "http://www.air-watch.com/servicemodel/resources",
          "#text": "C"
        },
        "Country": {
          "-xmlns": "http://www.air-watch.com/servicemodel/resources",
          "#text": "s"
        },
        "Locale": {
          "-xmlns": "http://www.air-watch.com/servicemodel/resources",
          "#text": "kk"
        },
        "ParentLocationGroup": {
          "-xmlns": "http://www.air-watch.com/servicemodel/resources",
          "-uuid": "bdce439362",
          "#text": "70"
        },
        "CreatedOn": {
          "-xmlns": "http://www.air-watch.com/servicemodel/resources",
          "#text": "2/21/2018 3:08:55 PM"
        },
}

Data format 2

<?xml version="1.0" encoding="utf-8" ?>
<SarttGroupSe xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.air-watch.com/servicemodel/resources">
    <Page>0</Page>
    <PageSize>500</PageSize>
    <Total>61</Total>
    <LocationGroups>
        <Id xmlns="">655</Id>
        <Name>EDX</Name>
        <GroupId>DDDD</GroupId>
        <LocationGroupType>Container</LocationGroupType>
        <Country/>
        <Locale/>
        <Users>0</Users>
        <Admins>0</Admins>
        <Devices>0</Devices>
    </LocationGroups>
    <LocationGroups>
        <Id xmlns="">2</Id>
        <Name>EE</Name>
        <GroupId>New</GroupId>
        <LocationGroupType>C</LocationGroupType>
        <Country/>
        <Locale/>
        <Users>0</Users>
        <Admins>0</Admins>
        <Devices>0</Devices>
    </LocationGroups>
    <LocationGroups>
        <Id xmlns="">6</Id>
        <Name>RAC</Name>
        <LocationGroupType>Ciner</LocationGroupType>
        <Country/>
        <Locale/>
        <Users>0</Users>
        <Admins>0</Admins>
        <Devices>0</Devices>
    </LocationGroups>
</SarttGroupSe>

What format these data can anyone help me out?


Solution

  • JSON objects are surrounded by curly braces {}.

    JSON objects are written in key/value pairs.

    Keys must be strings, and values must be a valid JSON data type (string, number, object, array, boolean or null).

    example { "name":"John", "age":30, "car":null } then your first example is a json object validate your first example in json validator

    The Element object represents an element in an XML document. Elements may contain attributes, other elements, or text. If an element contains text, the text is represented in a text-node.

    example <year>2005</year> then your second example is a xml object

    try your second example in xml validator