Versionen im Vergleich

Schlüssel

  • Diese Zeile wurde hinzugefügt.
  • Diese Zeile wurde entfernt.
  • Formatierung wurde geändert.
Seiteneigenschaften

Deutsch

Json JSON wird auf der Webseite https://de.wikipedia.org/wiki/JavaScript_Object_Notation wie folgt beschrieben:

JavaScript Object Notation ist ein offenes Standard-Dateiformat und Datenaustauschformat, das menschenlesbaren Text zum Speichern und Übertragen von Datenobjekten verwendet, die aus Attribut-Wert-Paaren und Array-Datentypen (oder jedem anderen serialisierbaren Wert) bestehen. Es ist ein sehr verbreitetes Datenformat mit einer Vielzahl von > Anwendungen, wie z. B. als Ersatz für XML in AJAX-Systemen.

Es folgt ein Beispiel für eine JSON-Datenstruktur, die (teilweise) ein Gerät in der LMC beschreibt:

{                                                       // an object is wrapped in curly braces
    "id": "20c00759-aaaa-bbbb-cccc-092158681e3e",       // the syntax is "attribute": <value>, comma-separated
    "siteName": "Würselen",                             // strings are "quoted"
    "siteId": "883a7141-aaaa-bbbb-cccc-627bf8c32b5e",
    "location": {                                       // "location" is a nested object
        "latitude": 50.8050285,                         // numbers are not quoted
        "longitude": 6.1493351
    },
    "customFields": [],                                 // a list is wrapped in square braces (this list is empty)
    "status": {
        "name": "Lancom-1781A",
        "serial": "4003767318100050",                   // this is a "string", allthough it contains only numbers
        "mac": "00:a0:57:26:fa:33",
        "ip": "192.168.59.9",
        "model": "LANCOM 1781A",
        "claimingState": "CLAIMED",
        "heartbeatState": "ACTIVE"
    }
}

Dieses Objekt kann in das entsprechende XML übersetzt werden:

<device>
  <id>20c00759-aaaa-bbbb-cccc-092158681e3e</id>
  <siteName>Würselen</siteName>
  <siteId>883a7141-aaaa-bbbb-cccc-627bf8c32b5e</siteId>
  <location>
    <latitude>50.805027</latitude>
    <longitude>6.149335</longitude>
  </location>
  <customFields />
  <status>
    <claimingState>CLAIMED</claimingState>
    <heartbeatState>ACTIVE</heartbeatState>
    <ip>192.168.59.9</ip>
    <mac>00:a0:57:26:fa:33</mac>
    <model>LANCOM 1781A</model>
    <name>Lancom-1781A</name>
    <serial>4003767318100050</serial>
  </status>
</device>
Info

Übung:

Definieren Sie ein Objekt mit JSON, das einen Punkt mit einer Koordinate von x = 8 und y = 15 sowie ein Kommentarfeld Hello World definiert.

Englisch

Json JSON is introduced on https://en.wikipedia.org/wiki/JSON as follows:

JavaScript Object Notation is an open standard file format, and data interchange format, that uses human-readable text to store and transmit data objects consisting of attribute–value pairs and array data types (or any other serializable value). It is a very common data format, with a diverse range of > applications, such as serving as a replacement for XML in AJAX systems.

The following is an example JSON data structure that (partially) describes a device in the LMC:

{                                                       // an object is wrapped in curly braces
    "id": "20c00759-aaaa-bbbb-cccc-092158681e3e",       // the syntax is "attribute": <value>, comma-separated
    "siteName": "Würselen",                             // strings are "quoted"
    "siteId": "883a7141-aaaa-bbbb-cccc-627bf8c32b5e",
    "location": {                                       // "location" is a nested object
        "latitude": 50.8050285,                         // numbers are not quoted
        "longitude": 6.1493351
    },
    "customFields": [],                                 // a list is wrapped in square braces (this list is empty)
    "status": {
        "name": "Lancom-1781A",
        "serial": "4003767318100050",                   // this is a "string", allthough it contains only numbers
        "mac": "00:a0:57:26:fa:33",
        "ip": "192.168.59.9",
        "model": "LANCOM 1781A",
        "claimingState": "CLAIMED",
        "heartbeatState": "ACTIVE"
    }
}

This object can be translated to the equivalent XML:

<device>
  <id>20c00759-aaaa-bbbb-cccc-092158681e3e</id>
  <siteName>Würselen</siteName>
  <siteId>883a7141-aaaa-bbbb-cccc-627bf8c32b5e</siteId>
  <location>
    <latitude>50.805027</latitude>
    <longitude>6.149335</longitude>
  </location>
  <customFields />
  <status>
    <claimingState>CLAIMED</claimingState>
    <heartbeatState>ACTIVE</heartbeatState>
    <ip>192.168.59.9</ip>
    <mac>00:a0:57:26:fa:33</mac>
    <model>LANCOM 1781A</model>
    <name>Lancom-1781A</name>
    <serial>4003767318100050</serial>
  </status>
</device>
Info

Exercise:

Define an object with JSON that defines a point with an x = 8 and y = 15 coordinate, as well as a comment field Hello World.


...