For the complete documentation index, see llms.txt. This page is also available as Markdown.

string.JsonParse

⚠️ Not a method in the current OSL CLI. Use the json package instead: json.parse(value, {type: "object" | "array"}) returns a Result.

Replacement

import "osl/json"

auto parsed = json.parse("{\"x\":10,\"y\":20}", {type: "object"})
if parsed.isOk() (
  object data = parsed.unwrap().assert(object)
  log data.x // 10
)

Last updated