PageSourceSearch

https://deck.gl/assets/js/7dcde71d.d71cfa68.js

js deck.gl collected 2026-09-24 08:43:43 UTC 5,185 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunkproject_website=self.webpackChunkproject_website||[]).push([["5477"],{13293(e,n,o){o.r(n),o.d(n,{metadata:()=>r,default:()=>h,frontMatter:()=>t,contentTitle:()=>c,toc:()=>l,assets:()=>a});var r=JSON.parse('{"id":"api-reference/json/json-configuration","title":"JSONConfiguration","description":"A JSONConfiguration is created from a single plain object. The same object shape is also accepted by JSONConfiguration.merge() and JSONConverter\'s configuration and mergeConfiguration() props.","source":"@site/../docs/api-reference/json/json-configuration.md","sourceDirName":"api-reference/json","slug":"/api-reference/json/json-configuration","permalink":"/docs/api-reference/json/json-configuration","draft":false,"unlisted":false,"editUrl":"https://github.com/visgl/deck.gl/tree/master/website/../docs/api-reference/json/json-configuration.md","tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"JSONConverter","permalink":"/docs/api-reference/json/json-converter"},"next":{"title":"Conversion Reference","permalink":"/docs/api-reference/json/conversion-reference"}}'),s=o(74848),i=o(28453);let t={},c="JSONConfiguration",a={},l=[{value:"Fields",id:"fields",level:2},{value:"Example",id:"example",level:2}];function d(e){let n={code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",ul:"ul",...(0,i.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.header,{children:(0,s.jsx)(n.h1,{id:"jsonconfiguration",children:"JSONConfiguration"})}),"\n",(0,s.jsxs)(n.p,{children:["A ",(0,s.jsx)(n.code,{children:"JSONConfiguration"})," is created from a single plain object. The same object shape is also accepted by ",(0,s.jsx)(n.code,{children:"JSONConfiguration.merge()"})," and ",(0,s.jsx)(n.code,{children:"JSONConverter"}),"'s ",(0,s.jsx)(n.code,{children:"configuration"})," and ",(0,s.jsx)(n.code,{children:"mergeConfiguration()"})," props."]}),"\n",(0,s.jsx)(n.h2,{id:"fields",children:"Fields"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"classes"})," - a map of classes available to the JSON class resolver. In deck.gl this is typically ",(0,s.jsx)(n.code,{children:"Layer"})," and ",(0,s.jsx)(n.code,{children:"View"})," classes."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"functions"})," - a map of functions available to the JSON function resolver."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"enumerations"})," - a map of enumerations available to the JSON string resolver."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"constants"})," - a map of constants available to the JSON string resolver."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"reactComponents"})," - a map of React components available to the JSON class resolver."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"React"})," - injected React runtime used when resolving ",(0,s.jsx)(n.code,{children:"reactComponents"}),"."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"typeKey"})," - override for the class discriminator key. Defaults to ",(0,s.jsx)(n.code,{children:"@@type"}),"."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"functionKey"})," - override for the function discriminator key. Defaults to ",(0,s.jsx)(n.code,{children:"@@function"}),"."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"convertFunction"})," - hook for converting ",(0,s.jsx)(n.code,{children:"@@="})," accessor strings into executable functions."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"preProcessClassProps"})," - hook that receives a resolved class/component and its props before instantiation."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"postProcessConvertedJson"})," - hook that receives the fully converted result before it is returned."]}),"\n"]}),"\n",(0,s.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"import {JSONConfiguration} from '@deck.gl/json';\nimport {MapView} from '@deck.gl/core';\nimport {ScatterplotLayer} from '@deck.gl/layers';
1\n\nconst configuration = new JSONConfiguration({\n  classes: {MapView, ScatterplotLayer},\n  functions: {\n    scaleRadius: ({value}) => value * 2\n  },\n  postProcessConvertedJson: json => ({\n    ...json,\n    layers: (json.layers || []).filter(Boolean)\n  })\n});\n"})}),"\n",(0,s.jsxs)(n.p,{children:["See more details in the ",(0,s.jsx)(n.code,{children:"Configuration Reference"})," section."]})]})}function h(e={}){let{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(d,{...e})}):d(e)}},28453(e,n,o){o.d(n,{R:()=>t,x:()=>c});var r=o(96540);let s={},i=r.createContext(s);function t(e){let n=r.useContext(i);return r.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:t(e.components),r.createElement(i.Provider,{value:n},e.children)}}}]);
2//# sourceMappingURL=7dcde71d.d71cfa68.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.