From c1dd5b7ee0070b37ff0740262b4084be3f4973c6 Mon Sep 17 00:00:00 2001 From: Svilen Markov <7613769+svilenmarkov@users.noreply.github.com> Date: Sat, 19 Jul 2025 16:49:53 +0100 Subject: [PATCH] Update docs and remove struct --- docs/custom-api.md | 4 +--- internal/glance/widget-custom-api.go | 5 ----- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/docs/custom-api.md b/docs/custom-api.md index 6b8711a..8fc712a 100644 --- a/docs/custom-api.md +++ b/docs/custom-api.md @@ -445,10 +445,8 @@ The following functions are available on the `JSON` object: - `Float(key string) float`: Returns the value of the key as a float. - `Bool(key string) bool`: Returns the value of the key as a boolean. - `Array(key string) []JSON`: Returns the value of the key as an array of `JSON` objects. -- `Object(key string)`: Returns the value of the key as a list of properties. - - `.Key`: the property name - - `.Value`: the property value - `Exists(key string) bool`: Returns true if the key exists in the JSON object. +- `Entries(key string)`: Returns an iterator that allows you to loop through each property of the object. Example: `{{ range $key, $value := .JSON.Entries "user" }}`. This will yield pairs of key and value, where `$key` is a string and `$value` is a `JSON` object. The following functions are available on the `Options` object: diff --git a/internal/glance/widget-custom-api.go b/internal/glance/widget-custom-api.go index 1a029db..419c158 100644 --- a/internal/glance/widget-custom-api.go +++ b/internal/glance/widget-custom-api.go @@ -358,11 +358,6 @@ type decoratedGJSONResult struct { gjson.Result } -type ObjectProperty struct { - Key string - Value decoratedGJSONResult -} - func gJsonResultArrayToDecoratedResultArray(results []gjson.Result) []decoratedGJSONResult { decoratedResults := make([]decoratedGJSONResult, len(results))