Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractJSONKeys ¶
ExtractJSONKeys extracts the top-level keys from a JSON object provided by an io.Reader.
It expects the input to be a valid JSON object (i.e., starting with '{'). The function iterates through all key-value pairs at the top level, collects the keys in the order they appear in the JSON string, and skips the values.
Parameters:
- r: an io.Reader containing the JSON object.
Returns:
- []string: a slice of strings containing the keys found at the top level of the JSON object, in the same order as in the input JSON.
- error: an error if the input is not a valid JSON object or if any decoding issues occur.
func FetchJSON ¶
FetchJSON fetches JSON data from the given URL and decodes it into the provided variable.
Parameters:
- url: the URL to fetch the JSON from.
- value: a pointer to the variable where the decoded JSON will be stored.
Returns:
- error: an error if the HTTP request fails or the JSON cannot be decoded.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.