From 16fb3fa4b59f27c1db19fdce937fb17309d93d95 Mon Sep 17 00:00:00 2001 From: Matthieu Vachon Date: Wed, 26 Jan 2022 12:01:10 -0500 Subject: [PATCH] Fixed `json.fromString` type definition Also added an extra detail to `Bytes` version --- pages/en/developer/assemblyscript-api.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pages/en/developer/assemblyscript-api.mdx b/pages/en/developer/assemblyscript-api.mdx index 2b6aa855c4a3..e11d0c3fa32b 100644 --- a/pages/en/developer/assemblyscript-api.mdx +++ b/pages/en/developer/assemblyscript-api.mdx @@ -621,10 +621,10 @@ import { json, JSONValueKind } from '@graphprotocol/graph-ts' JSON data can be parsed using the `json` API: -- `json.fromBytes(data: Bytes): JSONValue` – parses JSON data from a `Bytes` array +- `json.fromBytes(data: Bytes): JSONValue` – parses JSON data from a `Bytes` array interpreted as a valid UTF-8 sequence - `json.try_fromBytes(data: Bytes): Result` – safe version of `json.fromBytes`, it returns an error variant if the parsing failed -- `json.fromString(data: Bytes): JSONValue` – parses JSON data from a valid UTF-8 `String` -- `json.try_fromString(data: Bytes): Result` – safe version of `json.fromString`, it returns an error variant if the parsing failed +- `json.fromString(data: string): JSONValue` – parses JSON data from a valid UTF-8 `String` +- `json.try_fromString(data: string): Result` – safe version of `json.fromString`, it returns an error variant if the parsing failed The `JSONValue` class provides a way to pull values out of an arbitrary JSON document. Since JSON values can be booleans, numbers, arrays and more, `JSONValue` comes with a `kind` property to check the type of a value: