mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-21 21:35:28 +02:00
Merge commit '5be51ac3db225d5df501ed1fa1499c41d97dbf65'
This commit is contained in:
@@ -3,23 +3,22 @@ title: data.GetJSON
|
||||
description: Returns a JSON object from a local or remote JSON file, or an error if the file does not exist.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
aliases: [getJSON]
|
||||
related: []
|
||||
returnType: any
|
||||
signatures: ['data.GetJSON INPUT... [OPTIONS]']
|
||||
toc: true
|
||||
params:
|
||||
functions_and_methods:
|
||||
aliases: [getJSON]
|
||||
returnType: any
|
||||
signatures: ['data.GetJSON INPUT... [OPTIONS]']
|
||||
expiryDate: 2026-02-19 # deprecated 2024-02-19 in v0.123.0
|
||||
---
|
||||
|
||||
{{% deprecated-in 0.123.0 %}}
|
||||
{{< deprecated-in 0.123.0 >}}
|
||||
Instead, use [`transform.Unmarshal`] with a [global resource](g), [page resource](g), or [remote resource](g).
|
||||
|
||||
See the [remote data example].
|
||||
|
||||
[`transform.Unmarshal`]: /functions/transform/unmarshal/
|
||||
[remote data example]: /functions/resources/getremote/#remote-data
|
||||
{{% /deprecated-in %}}
|
||||
{{< /deprecated-in >}}
|
||||
|
||||
Given the following directory structure:
|
||||
|
||||
@@ -36,9 +35,8 @@ Access the data with either of the following:
|
||||
{{ $data := getJSON "other-files/" "books.json" }}
|
||||
```
|
||||
|
||||
{{% note %}}
|
||||
When working with local data, the file path is relative to the working directory.
|
||||
{{% /note %}}
|
||||
> [!note]
|
||||
> When working with local data, the file path is relative to the working directory.
|
||||
|
||||
Access remote data with either of the following:
|
||||
|
||||
|
Reference in New Issue
Block a user