aboutsummaryrefslogtreecommitdiff
path: root/files/de/web/api/body/json/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/de/web/api/body/json/index.html')
-rw-r--r--files/de/web/api/body/json/index.html73
1 files changed, 0 insertions, 73 deletions
diff --git a/files/de/web/api/body/json/index.html b/files/de/web/api/body/json/index.html
deleted file mode 100644
index 76271e680d..0000000000
--- a/files/de/web/api/body/json/index.html
+++ /dev/null
@@ -1,73 +0,0 @@
----
-title: Body.json()
-slug: Web/API/Body/json
-translation_of: Web/API/Body/json
----
-<div>{{APIRef("Fetch")}}</div>
-
-<p>Die Methode <strong><code>json()</code></strong> des {{domxref("Body")}} Mixin nimmt einen {{domxref("Response")}} Stream und liest ihn bis zum Ende. Sie gibt ein Promise zurück, welches den Inhalt des Body als {{jsxref("JSON")}} einliest.</p>
-
-<h2 id="Syntax">Syntax</h2>
-
-<pre class="brush: js">response.json().then(function(data) {
- // mach etwas mit data
-});</pre>
-
-<h3 id="Parameter">Parameter</h3>
-
-<p>Keine.</p>
-
-<h3 id="Rückgabewert">Rückgabewert</h3>
-
-<p>Ein Promise, welches den Inhalt des Body als {{jsxref("JSON")}} einliest. Dies kann alles sein, was als JSON abgebildet werden kann — ein Objekt, ein Array, ein String, eine Zahl...</p>
-
-<h2 id="Beispiel">Beispiel</h2>
-
-<p>In unserem <a href="https://github.com/mdn/fetch-examples/tree/master/fetch-json">Beispiel für den Abruf eines json</a> (<a href="https://mdn.github.io/fetch-examples/fetch-json/">live ausführen</a>) erstellen wir eine neue Anfrage mit dem {{domxref("Request.Request")}} Konstruktor und rufen dann eine <code>.json</code> Datei ab. Wenn der Abruf erfolgreich ist lesen wir die Daten ein und parsen sie mit <code>json()</code>, lesen die Werte erwartungsgemäß aus und fügen sie in eine Liste ein um unsere Produktdaten anzuzeigen.</p>
-
-<pre class="brush: js">var myList = document.querySelector('ul');
-
-var myRequest = new Request('products.json');
-
-fetch(myRequest)
- .then(function(response) { return response.json(); })
- .then(function(data) {
- for (var i = 0; i &lt; data.products.length; i++) {
- var listItem = document.createElement('li');
- listItem.innerHTML = '&lt;strong&gt;' + data.products[i].Name + '&lt;/strong&gt; befindet sich in ' +
- data.products[i].Location +
- '. Preis: &lt;strong&gt;' + data.products[i].Price + '€&lt;/strong&gt;';
- myList.appendChild(listItem);
- }
- });</pre>
-
-<h2 id="Spezifikationen">Spezifikationen</h2>
-
-<table class="standard-table">
- <tbody>
- <tr>
- <th scope="col">Specification</th>
- <th scope="col">Status</th>
- <th scope="col">Comment</th>
- </tr>
- <tr>
- <td>{{SpecName('Fetch','#dom-body-json','json()')}}</td>
- <td>{{Spec2('Fetch')}}</td>
- <td> </td>
- </tr>
- </tbody>
-</table>
-
-<h2 id="Browserkompatibilität">Browserkompatibilität</h2>
-
-
-
-<p>{{Compat("api.Body.json")}}</p>
-
-<h2 id="Siehe_auch">Siehe auch</h2>
-
-<ul>
- <li><a href="/de/docs/Web/API/ServiceWorker_API">ServiceWorker API</a></li>
- <li><a href="/de/docs/Web/HTTP/Access_control_CORS">HTTP access control (CORS)</a></li>
- <li><a href="/de/docs/Web/HTTP">HTTP</a></li>
-</ul>