Skip to content

diegonc/gatsby-transformer-rawjson

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

npm

gatsby-transformer-rawjson

Exposes JSON values as a scalar field in GraphQL schema.

Install

npm install --save gatsby-transformer-rawjson

How to use

In your gatsby-config.js:

module.exports = {
  plugins: [
    `gatsby-transformer-json`,
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        path: `./src/data/`,
      },
    },
    `gatsby-transformer-rawjson`,
  ],
}

How to query

Assuming a letters.json file was loaded

{
  allLettersJson {
    edges {
      node {
        objectValue {
          es
          en
        }
        childRawLettersJson {
          objectValue
        }
      }
    }
  }
}

Which would return:

{
  allLettersJson: {
    edges: [
      {
        node: {
          objectValue: {
            "es": "...",
            "en": "..."
          }
          childRawLettersJson {
            objectValue: {
              "es": "...",
              "en": "..."
            }
          }
        },
      }
    ]
  }
}

About

Expose values as JSON type in GraphQL schema

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published