ee.String.decodeJSON
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Dekoduje ciąg JSON.
Wykorzystanie | Zwroty |
---|
String.decodeJSON() | Obiekt |
Argument | Typ | Szczegóły |
---|
to: string | Ciąg znaków | Ciąg do zdekodowania. |
Przykłady
Edytor kodu (JavaScript)
var data = ee.Dictionary(ee.String('{"a": "abc", "b": 1}').decodeJSON());
print(data);
print(data.get('a'));
Konfiguracja Pythona
Informacje o interfejsie Python API i używaniu geemap
do interaktywnego programowania znajdziesz na stronie
Środowisko Python.
import ee
import geemap.core as geemap
Colab (Python)
data = ee.Dictionary(ee.String('{"a": "abc", "b": 1}').decodeJSON())
print(data.getInfo())
print(data.get('a').getInfo())
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-07-26 UTC.
[null,null,["Ostatnia aktualizacja: 2025-07-26 UTC."],[[["\u003cp\u003eDecodes a JSON string (this: \u003ccode\u003estring\u003c/code\u003e) and returns an \u003ccode\u003eObject\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eProvides usage examples in JavaScript, Python using \u003ccode\u003egeemap\u003c/code\u003e, and Colab with Python.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003edecodeJSON()\u003c/code\u003e method is called on an \u003ccode\u003eee.String\u003c/code\u003e object containing the JSON string.\u003c/p\u003e\n"],["\u003cp\u003eThe resulting object can be accessed like a dictionary using methods like \u003ccode\u003eget()\u003c/code\u003e to retrieve specific values.\u003c/p\u003e\n"]]],[],null,["# ee.String.decodeJSON\n\nDecodes a JSON string.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|-----------------------|---------|\n| String.decodeJSON`()` | Object |\n\n| Argument | Type | Details |\n|----------------|--------|-----------------------|\n| this: `string` | String | The string to decode. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\nvar data = ee.Dictionary(ee.String('{\"a\": \"abc\", \"b\": 1}').decodeJSON());\nprint(data);\nprint(data.get('a'));\n```\nPython setup\n\nSee the [Python Environment](/earth-engine/guides/python_install) page for information on the Python API and using\n`geemap` for interactive development. \n\n```python\nimport ee\nimport geemap.core as geemap\n```\n\n### Colab (Python)\n\n```python\ndata = ee.Dictionary(ee.String('{\"a\": \"abc\", \"b\": 1}').decodeJSON())\nprint(data.getInfo())\nprint(data.get('a').getInfo())\n```"]]