What does it mean

0
Hi Experts,   I am learning Create JSON Import in Crash Course.   When you want to integrate with an external system, like a JSON rest service, you start by telling Mendix about the structure of your data. You do this by creating a structure document, in our case a JSON structure. Let’s try that out.   what does the "telling structure" refer to? Thank you.
asked
1 answers
0

Hello Wenyu,

 

A JSON message has a certain structure, so the message that you send or received will have certain objects, lists, attributes(fields), this structure of where in the message is mentioned what you can upload/create in mendix. This helps a system too map the elements from a message to a different structure or just helps to know what is in the message. 

 

So, for example, the structure of the added snippet is the following:

the cars array contains objects that have properties for make, model, and year. Each car object also has a nested specs object that includes details about the engine, horsepower, and transmission, making it two layers deep, further you can see which attributes are strings or integers/decimals

 

{
  "cars": [
    {
      "make": "Toyota",
      "model": "Camry",
      "year": 2022,
      "specs": {
        "engine": "2.5L 4-Cylinder",
        "horsepower": 203,
        "transmission": "8-Speed Automatic"
      }
    },
    {
      "make": "Honda",
      "model": "Civic",
      "year": 2021,
      "specs": {
        "engine": "2.0L 4-Cylinder",
        "horsepower": 158,
        "transmission": "CVT"
      }
    },
    {
      "make": "Ford",
      "model": "Mustang",
      "year": 2023,
      "specs": {
        "engine": "5.0L V8",
        "horsepower": 450,
        "transmission": "6-Speed Manual"
      }
    }
  ]
}

 

Hope this helps,

 

Good luck!

answered