1.0.2 • Published 7 months ago

json-categorize v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
7 months ago

GitHub

Overview

The Categorize JSON Extension provides a convenient way to organize JSON data by grouping fields based on their prefixes. This is particularly useful for applications that need to structure data sections dynamically, making the JSON response more readable and easier to work with.

For example, fields such as navbar_blog, navbar_forum, and footer_privacy_policy are automatically grouped under sections like navbar and footer, resulting in a more structured JSON output.

Special cases

  • Ignored fields: Field languages_code and fields that ends with _id are not categorized.
  • No subfield fields: For fields without a specific subfield (e.g., source and source_type), the category is determined by the prefix, and any standalone field (like source) without an underscore is categorized under a value.

Example of JSON categorization

Usage

After installation, this middleware will automatically organize JSON data for specified item routes in Directus.

To retrieve and categorize a specific item by its ID, use the following route:

GET /items/:collection/:id

If you use all in place of the :id parameter, the middleware will retrieve and categorize all items in the specified collection, returning a list of categorized objects:

GET /items/:collection/all
acornansi-escapesansi-regexansi-stylesargparseasynckitaxiosbalanced-matchbase64-jsblboolbasebrace-expansionbrowserslistbufferbuffer-fromcallsitescaniuse-apicaniuse-litechalkchardetcli-cursorcli-spinnerscli-widthclonecolor-convertcolor-namecolordcolorettecombined-streamcommandercommondircosmiconfigcross-spawncss-declaration-sortercss-selectcss-treecss-whatcssesccssnanocssnano-preset-defaultcssnano-utilscssocsstypedate-fnsdebugdecamelizedecode-uri-componentdeepmergedefaultsdefudelayed-streamdom-serializerdomelementtypedomhandlerdomutilselectron-to-chromiumemoji-regexentitieserror-exes-module-lexeresbuildescaladeesmestree-walkereventemitter3execaexternal-editorfilter-objflatfollow-redirectsform-datafs-extrafs.realpathfunction-bindget-package-typeget-streamgetoptsglobgraceful-fshasownhookablehuman-signalsiconv-liteicss-utilsieee754import-freshinflightinheritsinquirerinterpretis-arrayishis-core-moduleis-fullwidth-code-pointis-interactiveis-moduleis-referenceis-streamis-unicode-supportedisexejoijoyconjs-tokensjs-yamljson-parse-even-better-errorsjsonc-parserjsonfileknexlilconfiglines-and-columnslodashlodash-eslodash.memoizelodash.uniqlog-symbolsmagic-stringmdn-datamerge-streammicromustachemime-dbmime-typesmimic-fnminimatchmsmute-streamnanoidnode-releasesnormalize-urlnpm-run-pathnth-checkonceonetimeoraos-tmpdirp-finallyp-queuep-timeoutparent-moduleparse-jsonpath-keypath-parsepath-typepg-connection-stringpicocolorspicomatchpiniapostcsspostcss-calcpostcss-colorminpostcss-convert-valuespostcss-discard-commentspostcss-discard-duplicatespostcss-discard-emptypostcss-discard-overriddenpostcss-merge-longhandpostcss-merge-rulespostcss-minify-font-valuespostcss-minify-gradientspostcss-minify-paramspostcss-minify-selectorspostcss-modules-extract-importspostcss-modules-local-by-defaultpostcss-modules-scopepostcss-modules-valuespostcss-normalize-charsetpostcss-normalize-display-valuespostcss-normalize-positionspostcss-normalize-repeat-stylepostcss-normalize-stringpostcss-normalize-timing-functionspostcss-normalize-unicodepostcss-normalize-urlpostcss-normalize-whitespacepostcss-ordered-valuespostcss-reduce-initialpostcss-reduce-transformspostcss-selector-parserpostcss-svgopostcss-unique-selectorspostcss-value-parserproxy-from-envquery-stringrandombytesreadable-streamrechoirresolveresolve-fromrestore-cursorrolluprollup-plugin-esbuildrollup-plugin-stylesrun-asyncrxjssafe-buffersafer-bufferserialize-javascriptshebang-commandshebang-regexsignal-exitsmobsource-mapsource-map-jssource-map-supportsplit-on-firststablestdin-discarderstrict-uri-encodestring-widthstring_decoderstrip-ansistrip-final-newlinestylehackssupports-preserve-symlinks-flagsvgotarntersertildifytmptslibtype-festundici-typesunheaduniversalifyupdate-browserslist-dbutil-deprecatevitevuewcwidthwhichwrap-ansiwrappyyamlyoctocolors-cjszheadzod
1.0.2

7 months ago

1.0.1

7 months ago

1.0.0

7 months ago